problem_statement stringlengths 147 8.53k | input stringlengths 1 771 | output stringlengths 1 592 ⌀ | time_limit stringclasses 32
values | memory_limit stringclasses 21
values | tags stringlengths 6 168 |
|---|---|---|---|---|---|
B. Cake Assembly Linetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA cake assembly line in a bakery was once again optimized, and now n cakes are made at a time! In the last step, each of the n cakes should be covered with chocolate.Consider a side view on the conv... | 43 10 565 95 16540 65 1455 2 11 6 11 16 214 9 14 19 243 3 213 22 295 16 254 4 127 36 127 13635 50 141 144 | YES YES NO YES | 1 second | 256 megabytes | ['brute force', 'sortings', '*1300'] |
A2. Alternating Deck (hard version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is a hard version of the problem. In this version, there are two colors of the cards.Alice has n cards, each card is either black or white. The cards are stacked in a deck in such... | 51061781000000 | 3 2 2 3 1 0 2 3 6 4 3 4 2 1 2 3 250278 249924 249722 250076 | 1 second | 256 megabytes | ['implementation', '*800'] |
A1. Non-alternating Deck (easy version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an easy version of the problem. In this version, all cards have the same color.Alice has n cards, each card is white, and the cards are stacked in a deck. Alice deals the c... | 51061781000000 | 5 5 1 5 10 7 3 5 500202 499798 | 1 second | 256 megabytes | ['implementation', '*800'] |
F. Minimums or Medianstime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputVika has a set of all consecutive positive integers from 1 to 2n, inclusive.Exactly k times Vika will choose and perform one of the following two actions: take two smallest integers from her cur... | 3 1
| 2 | 4 seconds | 512 megabytes | ['*3400'] |
E. Infinite Gametime limit per test5 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAlice and Bob are playing an infinite game consisting of sets. Each set consists of rounds. In each round, one of the players wins. The first player to win two rounds in a set wins this set. Thus, a set... | ??
| 1 2 1 | 5 seconds | 512 megabytes | ['brute force', 'combinatorics', 'dp', 'games', 'probabilities', '*3100'] |
D. Wooden Spoontime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard output2^n people, numbered with distinct integers from 1 to 2^n, are playing in a single elimination tournament. The bracket of the tournament is a full binary tree of height n with 2^n leaves.When two players... | 1
| 0 2 | 4 seconds | 512 megabytes | ['combinatorics', 'dp', '*2400'] |
C. Monsters (hard version)time limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. In this version, you need to find the answer for every prefix of the monster array.In a computer game, you are fighting against n monsters. Monster num... | 233 1 264 1 5 4 1 1 | 2 1 0 3 2 4 4 4 4 | 4 seconds | 512 megabytes | ['data structures', 'greedy', '*2200'] |
B. Letter Exchangetime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputA cooperative game is played by m people. In the game, there are 3m sheets of paper: m sheets with letter 'w', m sheets with letter 'i', and m sheets with letter 'n'.Initially, each person is given th... | 32nwiinw3innnwwwii4winwwwiiinnn | 0 2 2 w 3 i 3 w 1 n 3 2 w 3 i 2 w 4 n 3 i 4 n | 4 seconds | 512 megabytes | ['constructive algorithms', '*1900'] |
A. Monsters (easy version)time limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. In this version, you only need to find the answer once. In this version, hacks are not allowed.In a computer game, you are fighting against n monsters.... | 233 1 264 1 5 4 1 1 | 0 4 | 4 seconds | 512 megabytes | ['brute force', 'greedy', '*1000'] |
G. Weighed Tree Radiustime limit per test6 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a tree of n vertices and n - 1 edges. The i-th vertex has an initial weight a_i.Let the distance d_v(u) from vertex v to vertex u be the number of edges on the path from v to u. Note... | 6
1 3 3 7 0 1
2 1
1 3
1 4
5 4
4 6
5
4 7
4 0
2 5
5 10
5 5
| 7 4 5 10 7 | 6 seconds | 512 megabytes | ['data structures', 'divide and conquer', 'implementation', 'trees', '*2800'] |
F. Double Sort IItime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given two permutations a and b, both of size n. A permutation of size n is an array of n elements, where each integer from 1 to n appears exactly once. The elements in each permutation are inde... | 5
1 3 2 4 5
2 1 3 4 5
| 1 2 | 2 seconds | 512 megabytes | ['dfs and similar', 'flows', 'graph matchings', 'graphs', '*2500'] |
E. Game of the Yeartime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp and Polycarp are playing a computer game. This game features n bosses for the playing to kill, numbered from 1 to n.They will fight each boss the following way: Monocarp makes k attempts t... | 331 1 12 3 111141 4 3 23 3 4 1 | 3 1 2 3 1 1 2 2 4 | 2 seconds | 256 megabytes | ['brute force', 'data structures', 'math', 'number theory', '*2300'] |
D. Different Arraystime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n integers.You have to perform the sequence of n-2 operations on this array: during the first operation, you either add a_2 to a_1 and subtract a_2 from a_3, o... | 4
1 1 1 1
| 3 | 2 seconds | 512 megabytes | ['brute force', 'dp', 'implementation', '*2000'] |
C. Yet Another Tournamenttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are participating in Yet Another Tournament. There are n + 1 participants: you and n other opponents, numbered from 1 to n.Each two participants will play against each other exactly once. I... | 54 401100 100 200 13 21 2 35 01 1 1 1 14 00 1 1 14 41 2 2 1 | 1 2 6 4 1 | 2 seconds | 256 megabytes | ['binary search', 'greedy', 'sortings', '*1700'] |
B. Matrix of Differencestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFor a square matrix of integers of size n \times n, let's define its beauty as follows: for each pair of side-adjacent elements x and y, write out the number |x-y|, and then find the number of d... | 223 | 1 3 4 2 1 3 4 9 2 7 5 8 6 | 2 seconds | 256 megabytes | ['constructive algorithms', 'math', '*1100'] |
A. Make it Beautifultime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAn array a is called ugly if it contains at least one element which is equal to the sum of all elements before it. If the array is not ugly, it is beautiful.For example: the array [6, 3, 9, 6] is u... | 443 3 6 6210 1051 2 3 4 531 4 4 | YES 3 6 3 6 NO YES 2 4 1 5 3 YES 1 4 4 | 3 seconds | 512 megabytes | ['constructive algorithms', 'math', 'sortings', '*800'] |
H2. Window Signals (hard version)time limit per test7 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. In this version, the constraints on h and w are higher.A house at the sea has h floors, all of the same height. The side of the house facing the... | 101 3 02 2 03 2 04 5 012 7 01 1 11 11 3 11 23 4 13 42 3 21 12 14 5 22 34 2 | 4 10 44 954368 34903934 0 2 1696 10 253144 | 7 seconds | 512 megabytes | ['*3500'] |
H1. Window Signals (easy version)time limit per test7 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. In this version, the constraints on h and w are lower.A house at the sea has h floors, all of the same height. The side of the house facing the ... | 101 3 02 2 03 2 04 5 012 7 01 1 11 11 3 11 23 4 13 42 3 21 12 14 5 22 34 2 | 4 10 44 954368 34903934 0 2 1696 10 253144 | 7 seconds | 512 megabytes | ['*3200'] |
G. Diverse Coloringtime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputIn this problem, we will be working with rooted binary trees. A tree is called a rooted binary tree if it has a fixed root and every vertex has at most two children.Let's assign a color — white or bl... | 271 2 2 1 5 581 2 3 4 5 6 7 | 0 1 2 1 0 1 wbwwwbb 0 1 0 1 0 1 0 wbwbwbwb | 4 seconds | 512 megabytes | ['constructive algorithms', 'trees', '*3200'] |
F. Bracket Insertiontime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputVika likes playing with bracket sequences. Today she wants to create a new bracket sequence using the following algorithm. Initially, Vika's sequence is an empty string, and then she will repeat the... | 1 7500
| 249561089 | 4 seconds | 512 megabytes | ['combinatorics', 'dp', 'math', 'trees', '*2700'] |
E. Rectangle Shrinkingtime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou have a rectangular grid of height 2 and width 10^9 consisting of unit cells. There are n rectangles placed on this grid, and the borders of these rectangles pass along cell borders. The i-th r... | 851 2 2 42 4 2 81 4 2 71 2 1 21 9 1 1021 1 1 101 5 1 1521 1 1 101 1 1 1051 3 1 71 3 1 81 1 1 41 2 1 71 10 1 1121 1 2 101 5 1 821 5 2 101 2 1 721 5 2 102 2 2 1552 6 2 71 4 2 51 5 1 91 7 2 101 2 1 6 | 15 1 2 2 4 2 5 2 8 1 5 1 7 0 0 0 0 1 9 1 10 15 1 1 1 10 1 11 1 15 10 1 1 1 10 0 0 0 0 10 0 0 0 0 1 8 1 8 1 1 1 4 1 5 1 7 1 10 1 11 20 1 1 2 10 0 0 0 0 15 1 5 2 10 1 2 1 4 20 1 5 1 10 2 2 2 15 16 2 6 2 6 2 4 2 5 0 0 0 0 1 7 2 10 1 2 1 6 | 4 seconds | 512 megabytes | ['binary search', 'brute force', 'data structures', 'greedy', 'implementation', 'two pointers', '*2300'] |
D. Many Perfect Squarestime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a set a_1, a_2, \ldots, a_n of distinct positive integers.We define the squareness of an integer x as the number of perfect squares among the numbers a_1 + x, a_2 + x, \ldots, a_n +... | 451 2 3 4 551 6 13 22 97110052 5 10 17 26 | 2 5 1 2 | 4 seconds | 512 megabytes | ['brute force', 'math', 'number theory', '*1800'] |
C. Equal Frequenciestime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputLet's call a string balanced if all characters that are present in it appear the same number of times. For example, "coder", "appall", and "ttttttt" are balanced, while "wowwow" and "codeforces" are... | 45hello10codeforces5eevee6appall | 1 helno 2 codefofced 1 eeeee 0 appall | 2 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'greedy', 'implementation', 'sortings', 'strings', '*1600'] |
B. Going to the Cinematime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputA company of n people is planning a visit to the cinema. Every person can either go to the cinema or not. That depends on how many other people will go. Specifically, every person i said: "I want ... | 421 170 1 2 3 4 5 686 0 3 3 6 7 2 753 0 0 3 3 | 2 1 3 2 | 2 seconds | 512 megabytes | ['brute force', 'greedy', 'sortings', '*1000'] |
A. Parallel Projectiontime limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputVika's house has a room in a shape of a rectangular parallelepiped (also known as a rectangular cuboid). Its floor is a rectangle of size w \times d, and the ceiling is right above at the constant ... | 555 20 2923 10 18 320 10 51 5 2 515 15 47 13 10 102 1000 21 1 1 99910 4 107 1 2 1 | 47 8 14 1002 17 | 1 second | 512 megabytes | ['geometry', 'math', '*800'] |
G. Delicious Desserttime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputToday is an important day for chef Tonio — an auditor has arrived in his hometown of Morioh. He has also arrived at Tonio's restaurant and ordered dessert. Tonio has not been prepared for this turn ... | 7
abacaba
| 11 | 3 seconds | 512 megabytes | ['binary search', 'dsu', 'hashing', 'math', 'number theory', 'string suffix structures', '*2400'] |
F. Three Chairstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day Kira found n friends from Morioh and decided to gather them around a table to have a peaceful conversation. The height of friend i is equal to a_i. It so happened that the height of each of the fr... | 3
1 2 3
| 1 | 1 second | 256 megabytes | ['bitmasks', 'brute force', 'combinatorics', 'data structures', 'dp', 'number theory', 'sortings', '*2300'] |
E. Josuke and Complete Graphtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputJosuke received a huge undirected weighted complete^\dagger graph G as a gift from his grandfather. The graph contains 10^{18} vertices. The peculiarity of the gift is that the weight of the... | 72 416 242 61 103 32562 2568125 100090 | 2 6 3 5 0 5 50045 | 2 seconds | 256 megabytes | ['binary search', 'brute force', 'data structures', 'math', 'number theory', '*2400'] |
D. Bit Guessing Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.Kira has a hidden positive integer n, and Hayato needs to guess it.Initially, Kira gives Hayato the value \mathrm{cnt} — the number of unit bits in the binary notation ... | 3
1
0
1
1
0
2
1
0 | - 1 ! 1 - 1 - 1 ! 2 - 2 - 1 ! 3 | 1 second | 256 megabytes | ['binary search', 'bitmasks', 'constructive algorithms', 'interactive', '*1800'] |
B. GCD Partitiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhile at Kira's house, Josuke saw a piece of paper on the table with a task written on it.The task sounded as follows. There is an array a of length n. On this array, do the following: select an integer... | 642 2 1 321 231 4 561 2 1 1 1 31012 30 37 88 12 78 89 17 2 1267 7 7 7 7 7 | 4 1 5 3 1 21 | 1 second | 256 megabytes | ['brute force', 'greedy', 'math', 'number theory', '*1100'] |
A. Hayato and Schooltime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday Hayato came home from school with homework.In the assignment, Hayato was given an array a of length n. The task was to find 3 numbers in this array whose sum is odd. At school, he claimed that ... | 631 1 141 1 2 231 2 351 4 5 1 242 6 2 455 6 3 2 1 | YES 1 2 3 YES 3 4 1 NO YES 1 3 4 NO YES 1 3 5 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', '*800'] |
H. Olympic Team Buildingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIron and Werewolf are participating in a chess Olympiad, so they want to practice team building. They gathered n players, where n is a power of 2, and they will play sports. Iron and Werewolf ar... | 4
60 32 59 87
| 1001 | 2 seconds | 256 megabytes | ['brute force', 'meet-in-the-middle', '*3500'] |
G. The Game of the Centurytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe time has finally come, MKnez and Baltic are to host The Game of the Century. For that purpose, they built a village to lodge its participants.The village has the shape of an equilateral tr... | 3300100101010003111011100 | 2 0 3 | 2 seconds | 256 megabytes | ['constructive algorithms', 'graphs', 'shortest paths', '*3000'] |
F. Xorcerer's Stonestime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMisha had been banned from playing chess for good since he was accused of cheating with an engine. Therefore, he retired and decided to become a xorcerer.One day, while taking a walk in a park, Mish... | 2
13 13
1
| 1 1 | 4 seconds | 512 megabytes | ['bitmasks', 'constructive algorithms', 'dp', 'trees', '*2500'] |
E. Anya's Simultaneous Exhibitiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.Anya has gathered n chess experts numbered from 1 to n for which the following properties hold: For any pair of players one of the players wins every game... | 3
1
1
1
| ? 1 010 ? 2 001 ? 3 100 ! 111 | 1 second | 256 megabytes | ['constructive algorithms', 'graphs', 'greedy', 'interactive', 'sortings', '*2400'] |
D. Boris and His Amazing Haircuttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBoris thinks that chess is a tedious game. So he left his tournament early and went to a barber shop as his hair was a bit messy.His current hair can be described by an array a_1,a_2,\ld... | 733 3 32 1 221 263 4 4 6 3 43 1 2 3 2 333 2 3101 2 3 4 5 6 7 8 9 101 2 3 4 5 6 7 8 9 10101 2 3 4 5 6 7 8 9 1031 1 11 1 2124 2 4 3 1 5 6 3 5 6 2 1137 9 4 5 3 3 3 6 8 10 3 2 55 3 1 5 3 2 2 5 8 5 1 1 581 5 3 5 4 2 3 1137 9 4 5 3 3 3 6 8 10 3 2 55 3 1 5 3 2 2 5 8 5 1 1 571 5 3 4 2 3 1319747843 2736467 9385783972039844 2039... | YES NO YES NO YES NO YES | 2 seconds | 256 megabytes | ['constructive algorithms', 'data structures', 'dp', 'dsu', 'greedy', 'sortings', '*1700'] |
C. Least Prefix Sumtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBaltic, a famous chess player who is also a mathematician, has an array a_1,a_2, \ldots, a_n, and he can perform the following operation several (possibly 0) times: Choose some index i (1 \leq i \le... | 64 3-1 -2 -3 -44 31 2 3 41 115 5-2 3 -5 1 -205 2-2 3 -5 -5 -2010 4345875723 -48 384678321 -375635768 -35867853 -35863586 -358683842 -81725678 38576 -357865873 | 1 1 0 0 3 4 | 2 seconds | 256 megabytes | ['data structures', 'greedy', '*1600'] |
B. MKnez's ConstructiveForces Tasktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMKnez wants to construct an array s_1,s_2, \ldots , s_n satisfying the following conditions: Each element is an integer number different from 0; For each pair of adjacent elements the... | 2
2
3
| YES 9 5 NO | 1 second | 256 megabytes | ['constructive algorithms', 'math', '*900'] |
A. Hall of Fametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThalia is a Legendary Grandmaster in chess. She has n trophies in a line numbered from 1 to n (from left to right) and a lamp standing next to each of them (the lamps are numbered as the trophies).A lamp ... | 6
2
LL
2
LR
2
RL
2
RR
7
LLRLLLR
7
RRLRRRL
| -1 1 0 -1 3 6 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'strings', '*800'] |
F. Maximizing Roottime limit per test2 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou are given a rooted tree consisting of n vertices numbered from 1 to n. Vertex 1 is the root of the tree. Each vertex has an integer value. The value of i-th vertex is a_i. You can do the followin... | 25 224 12 24 6 121 21 32 42 55 324 12 24 6 121 21 32 42 5 | 288 576 | 2 seconds | 1024 megabytes | ['dfs and similar', 'dp', 'graphs', 'math', 'number theory', 'trees', '*2600'] |
E. The Tree Has Fallen!time limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputRecently, a tree has fallen on Bob's head from the sky. The tree has n nodes. Each node u of the tree has an integer number a_u written on it. But the tree has no fixed root, as it has fallen fro... | 3612 12 8 25 6 11 51 22 62 32 434 23 51 223 81 242 22 11 21 133 8 71 22 322 22 1 | 15 6 29 11 3 8 11 15 3 | 3 seconds | 512 megabytes | ['bitmasks', 'dfs and similar', 'math', 'trees', '*2500'] |
D. Flexible String Revisittime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two binary strings a and b of length n. In each move, the string a is modified in the following way. An index i (1 \leq i \leq n) is chosen uniformly at random. The character a_... | 41012000041000111050100110111 | 1 0 665496254 665496277 | 2 seconds | 256 megabytes | ['combinatorics', 'dp', 'math', 'probabilities', '*2100'] |
C. Flexible Stringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a string a and a string b. Both of the strings have length n. There are at most 10 different characters in the string a. You also have a set Q. Initially, the set Q is empty. You can apply th... | 63 1abcabd3 0abcabd3 1xbbxcd4 1abcdaxcb3 10abcabd10 3lkwhbahuqaqoiujoncjb | 6 3 6 6 6 11 | 2 seconds | 256 megabytes | ['bitmasks', 'brute force', 'strings', '*1600'] |
B. The Forbidden Permutationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p of length n, an array of m distinct integers a_1, a_2, \ldots, a_m (1 \le a_i \le n), and an integer d.Let \mathrm{pos}(x) be the index of x in the permutation ... | 54 2 21 2 3 41 35 2 45 4 3 2 15 25 3 33 4 1 5 23 1 22 2 11 22 16 2 41 2 3 4 5 62 5 | 1 3 2 0 2 | 2 seconds | 256 megabytes | ['greedy', 'math', '*1300'] |
A. Flip Flop Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array of n integers a_1, a_2, \ldots, a_n. The integers are either 1 or -1. You have to perform the following operation exactly once on the array a: Choose an index i (1 \leq i < n) and... | 45-1 1 1 -1 -151 1 -1 -1 -121 141 -1 -1 1 | 3 3 -2 4 | 1 second | 256 megabytes | ['greedy', 'implementation', '*800'] |
F. Comfortably Numbtime limit per test8 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n non-negative integers.The numbness of a subarray a_l, a_{l+1}, \ldots, a_r (for arbitrary l \leq r) is defined as \max(a_l, a_{l+1}, \ldots, a_r) \oplus (a_l... | 251 2 3 4 5310 47 52 | 7 47 | 8 seconds | 1024 megabytes | ['bitmasks', 'data structures', 'divide and conquer', 'strings', 'trees', '*2400'] |
E. Edge Reversetime limit per test4 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou will be given a weighted directed graph of n nodes and m directed edges, where the i-th edge has a weight of w_i (1 \le i \le m).You need to reverse some edges of this graph so that there is at least... | 42 11 2 35 41 2 102 3 103 1 104 5 104 51 2 100002 3 200001 3 300004 2 5004 3 204 51 2 100002 3 200001 3 300004 2 54 3 20 | 0 -1 20 5 | 4 seconds | 512 megabytes | ['binary search', 'dfs and similar', 'graphs', 'trees', '*2200'] |
D. Score of a Treetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given a tree of n nodes, rooted at 1. Every node has a value of either 0 or 1 at time t=0.At any integer time t>0, the value of a node becomes the bitwise XOR of the values of its children at ... | 161 21 33 43 53 6 | 288 | 2 seconds | 512 megabytes | ['bitmasks', 'combinatorics', 'dfs and similar', 'dp', 'math', 'probabilities', 'trees', '*1900'] |
C. Quiz Mastertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA school has to decide on its team for an international quiz. There are n students in the school. We can describe the students using an array a where a_i is the smartness of the i-th (1 \le i \le n) stude... | 32 43 74 23 7 2 95 76 4 3 5 7 | -1 0 3 | 2 seconds | 256 megabytes | ['binary search', 'math', 'number theory', 'sortings', 'two pointers', '*1700'] |
B. Emordnilaptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation (2 appears twice in the ar... | 312100 | 0 4 389456655 | 1 second | 256 megabytes | ['combinatorics', 'greedy', 'math', '*900'] |
A. Everybody Likes Good Arrays!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array a is good if for all pairs of adjacent elements, a_i and a_{i+1} (1\le i \lt n) are of different parity. Note that an array of size 1 is trivially good.You are given an array of s... | 351 7 11 2 1341 2 3 461 1 1 2 2 3 | 2 0 3 | 1 second | 256 megabytes | ['greedy', 'math', '*800'] |
N. Count Permutationstime limit per test5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a string s with length n-1 whose characters are either \texttt{<} or \texttt{>}.Count the permutations p_1, \, p_2, \, \dots, \, p_n of 1, \, 2, \, \dots, \, n such that, for all i = ... | 2
<
| 0.0000000000 | 5 seconds | 256 megabytes | ['math', '*3500'] |
M. Parmigiana With Seafoodtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe "Parmigiana di melanzane" is a typical Italian dish. Alessandro and Bianca have very different tastes when it comes to it: Alessandro loves to eat Parmigiana with seafood, but Bianca think... | 4
1 2
1 3
1 4
| 4 | 2 seconds | 256 megabytes | ['binary search', 'dp', 'greedy', 'trees', '*3000'] |
L. Controllerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are at your grandparents' house and you are playing an old video game on a strange console. Your controller has only two buttons and each button has a number written on it.Initially, your score is 0. ... | 8
+-+---+-
5
2 1
10 3
7 9
10 10
5 3
| YES NO NO NO YES | 2 seconds | 256 megabytes | ['binary search', 'math', '*1500'] |
K. Uniform Chemistrytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn a parallel universe there are n chemical elements, numbered from 1 to n. The element number n has not been discovered so far, and its discovery would be a pinnacle of research and would bring the... | 2 3
1 1 1
| 1.0 1.0 1.0 | 2 seconds | 256 megabytes | ['dp', 'math', '*3200'] |
J. Italian Data Centerstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn Italian data center consists of a set of servers, each colored green, white, or red, and a set of wires connecting them. Each wire connects two distinct servers and two servers are connected b... | 3 3 0
1 2 3
1 2
2 3
3 1
| 1 | 2 seconds | 256 megabytes | ['graphs', 'shortest paths', '*2500'] |
I. Spinach Pizzatime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe two siblings Alberto and Beatrice have to eat a spinach pizza together. However, none of them likes spinach, so they both want to eat as little as possible.The pizza has the shape of a strictly conv... | 4
0 0
6 1
5 3
1 4
| - | 2 seconds | 256 megabytes | ['games', 'geometry', 'greedy', 'interactive', '*2500'] |
H. Beppa and SwerChattime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBeppa and her circle of geek friends keep up to date on a group chat in the instant messaging app SwerChat^{\text{TM}}.The group has n members, excluding Beppa. Each of those members has a unique I... | 451 4 2 5 34 5 1 2 361 2 3 4 5 61 2 3 4 5 688 2 4 7 1 6 5 35 6 1 4 8 2 7 3111 | 2 0 4 0 | 2 seconds | 256 megabytes | ['two pointers', '*1300'] |
G. Another Wine Tasting Eventtime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter the first successful edition, Gabriella has been asked to organize a second wine tasting event. There will be 2n - 1 bottles of wine arranged in a row, each of which is either red w... | 5
RWWRRRWWW
| 2 | 0.5 seconds | 256 megabytes | ['combinatorics', 'constructive algorithms', 'math', 'strings', '*2100'] |
F. Train Splittingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n big cities in Italy, and there are m train routes between pairs of cities. Each route connects two different cities bidirectionally. Moreover, using the trains one can reach every city sta... | 25 91 21 31 41 52 32 42 53 43 53 31 23 12 3 | 4 1 2 3 1 4 2 2 4 3 3 2 3 1 | 2 seconds | 256 megabytes | ['constructive algorithms', 'graphs', 'greedy', '*1700'] |
E. Crossing the Railwaystime limit per test4 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputIsona is in a train station. This station has two platforms, and between them there are m parallel railways that can be viewed as infinite straight lines. Each railway is identified with an int... | 4 3 5 1
1 2 1
3 4 1
2 3 2
3 4 3
| 0 | 4 seconds | 1024 megabytes | ['data structures', 'dp', '*3500'] |
D. Teamworktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs soon as SWERC starts, your experienced 3-person team immediately realizes that the contest features a easy problems, b medium problems, and c hard problems. Solving a problem will take any of you 2, 3, or ... | 2 1 1 3
| 2 1 0 2 2 0 3 | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'math', '*2800'] |
C. Library gametime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAlessia and Bernardo are discovering the world of competitive programming through the books of their university library.The library consists of m sections numbered from 1 to m. Each section contains only... | 5 14
3 7 2 3 10
| - | 2 seconds | 256 megabytes | ['games', 'greedy', 'interactive', 'sortings', '*2500'] |
B. Vittorio Plays with LEGO Brickstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputVittorio is playing with his new LEGO Duplo bricks. All the bricks have the shape of a square cuboid with a 2 \times 2 square base and a height of 1. They can be arranged in the 3D spa... | 4 0
2 7 11 13
| 0 | 2 seconds | 256 megabytes | ['dp', 'geometry', '*2200'] |
A. Walking Boytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne of the SWERC judges has a dog named Boy. Besides being a good competitive programmer, Boy loves fresh air, so she wants to be walked at least twice a day. Walking Boy requires 120 consecutive minutes.... | 614100 200 300 400 500 600 700 800 900 1000 1100 1200 1300 140012100 200 300 400 600 700 800 900 1100 1200 1300 140013100 200 300 400 500 600 700 800 900 1100 1200 1300 140013101 189 272 356 463 563 659 739 979 1071 1170 1274 135814250 1 2 3 4 | NO YES NO YES YES YES | 2 seconds | 256 megabytes | ['greedy', '*800'] |
F. Laboratory on Plutotime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you know, Martian scientists are actively engaged in space research. One of the highest priorities is Pluto. In order to study this planet in more detail, it was decided to build a laboratory o... | 3 1127 | 1 1 # 1 2 ## 2 4 .### #### | 2 seconds | 256 megabytes | ['constructive algorithms', 'dp', 'greedy', 'math', '*2500'] |
E. The Human Equationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya and his friend, the robot Petya++, went to BFDMONCON, where the costume contest is taking place today. While walking through the festival, they came across a scientific stand named after Pro... | 531 2 -351 0 0 -1 -162 -4 3 -5 4 151 -1 1 -1 170 0 0 0 0 0 0 | 3 2 6 1 0 | 1 second | 256 megabytes | ['greedy', 'implementation', '*2100'] |
D. Friendly Spiderstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMars is home to an unusual species of spiders — Binary spiders.Right now, Martian scientists are observing a colony of n spiders, the i-th of which has a_i legs.Some of the spiders are friends with e... | 7
2 14 9 6 8 15 11
5 6
| 3 5 4 6 | 2 seconds | 256 megabytes | ['dfs and similar', 'graphs', 'math', 'number theory', 'shortest paths', '*1800'] |
C. Interesting Sequencetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya and his friend, robot Petya++, like to solve exciting math problems.One day Petya++ came up with the numbers n and x and wrote the following equality on the board: n\ \&\ (n+1)\ \&\ \dots\ \... | 510 810 1010 4220 161000000000000000000 0 | 12 10 -1 24 1152921504606846976 | 1 second | 256 megabytes | ['bitmasks', 'math', '*1600'] |
B. Gardener and the Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe gardener Kazimir Kazimirovich has an array of n integers c_1, c_2, \dots, c_n.He wants to check if there are two different subsequences a and b of the original array, for which f(a) = f(b),... | 532 1 52 2 42 2 322 1 21 243 1 2 42 2 44 1 2 5 62 2 553 3 1 23 2 5 35 7 2 3 1 45 1 2 6 3 53 2 6 321 11 2 | No Yes Yes Yes No | 2 seconds | 256 megabytes | ['bitmasks', 'constructive algorithms', '*1300'] |
A2. Gardener and the Capybaras (hard version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an hard version of the problem. The difference between the versions is that the string can be longer than in the easy version. You can only do hacks if both versions ... | 5bbbaabaaaaabbaabbb | b bb a a b a a a a ab b a a bb b | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', '*900'] |
A1. Gardener and the Capybaras (easy version)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an easy version of the problem. The difference between the versions is that the string can be longer than in the easy version. You can only do hacks if both versions ... | 5bbbaabaaaaabbaabbb | b bb a a b a a a a ab b a a bb b | 1 second | 256 megabytes | ['brute force', 'constructive algorithms', 'implementation', '*800'] |
H. Maximum Permutationtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputEcrade bought a deck of cards numbered from 1 to n. Let the value of a permutation a of length n be \min\limits_{i = 1}^{n - k + 1}\ \sum\limits_{j = i}^{i + k - 1}a_j.Ecrade wants to find the mos... | 2
5 4
8 4
| 13 1 4 5 3 2 18 4 2 5 7 8 3 1 6 | 2 seconds | 256 megabytes | ['constructive algorithms', '*3500'] |
G. Segment Coveringtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputChthollyNotaSeniorious gives DataStructures a number axis with m distinct segments on it. Let f(l,r) be the number of ways to choose an even number of segments such that the union of them is exactly ... | 4 2
1 3
4 6
2 4
3 5
1 4
1 5
| 1 0 | 2 seconds | 256 megabytes | ['brute force', 'combinatorics', 'constructive algorithms', 'data structures', 'dp', 'trees', '*3200'] |
F2. Magician and Pigs (Hard Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The only difference between the two versions is the constraint on n and x. You can make hacks only if both versions of the problem are solved... | 4
1 8
2 3
3
3
| 2 | 2 seconds | 256 megabytes | ['binary search', 'brute force', 'data structures', 'implementation', '*2700'] |
F1. Magician and Pigs (Easy Version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the easy version of the problem. The only difference between the two versions is the constraint on n and x. You can make hacks only if both versions of the problem are solved... | 4
1 8
2 3
3
3
| 2 | 2 seconds | 256 megabytes | ['brute force', 'data structures', 'implementation', '*2400'] |
E. Two Chess Piecestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputCirno_9baka has a tree with n nodes. He is willing to share it with you, which means you can operate on it.Initially, there are two chess pieces on the node 1 of the tree. In one step, you can choose... | 4 2
1 2
1 3
2 4
1 3
1 4
| 6 | 2 seconds | 256 megabytes | ['dfs and similar', 'dp', 'greedy', 'trees', '*1900'] |
D. Same Count Onetime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputChthollyNotaSeniorious received a special gift from AquaMoon: n binary arrays of length m. AquaMoon tells him that in one operation, he can choose any two arrays and any position pos from 1 to m, and s... | 33 41 1 1 00 0 1 01 0 0 14 31 0 00 1 10 0 10 0 02 20 00 1 | 1 2 1 1 1 4 2 2 -1 | 2 seconds | 512 megabytes | ['brute force', 'constructive algorithms', 'greedy', 'implementation', 'two pointers', '*1600'] |
C. Ice and Firetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLittle09 and his friends are playing a game. There are n players, and the temperature value of the player i is i. The types of environment are expressed as 0 or 1. When two players fight in a specific env... | 240014101 | 1 1 3 1 2 3 | 1 second | 256 megabytes | ['constructive algorithms', 'dp', 'greedy', '*1300'] |
B. Coloringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputCirno_9baka has a paper tape with n cells in a row on it. As he thinks that the blank paper tape is too dull, he wants to paint these cells with m kinds of colors. For some aesthetic reasons, he thinks that t... | 212 6 21 1 1 1 1 712 6 22 2 2 2 2 2 | NO YES | 1 second | 256 megabytes | ['constructive algorithms', 'greedy', 'math', '*1500'] |
A. Add Plus Minus Signtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAquaMoon has a string a consisting of only 0 and 1. She wants to add + and - between all pairs of consecutive positions to make the absolute value of the resulting expression as small as possible. ... | 3211501101510001 | - +-++ +++- | 1 second | 256 megabytes | ['constructive algorithms', 'math', '*800'] |
L. Lisa's Sequencestime limit per test5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputLisa loves playing with the sequences of integers. When she gets a new integer sequence a_i of length n, she starts looking for all monotone subsequences. A monotone subsequence [l, r] is defined by... | 5 3
1 2 3 4 5
| 2 1 0 3 0 5 | 5 seconds | 1024 megabytes | ['dp', '*3500'] |
J. Jumbled Treestime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputYou are given an undirected connected graph with n vertices and m edges. Each edge has an associated counter, initially equal to 0. In one operation, you can choose an arbitrary spanning tree and add a... | 3 3 101
1 2 30
2 3 40
3 1 50
| 3 10 1 2 20 1 3 30 2 3 | 3 seconds | 1024 megabytes | ['constructive algorithms', 'math', '*2900'] |
I. Interactive Factorial Guessingtime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputOh no, this wicked jury hides something from you again, and you need to guess it interactively. This time, you need to find an integer n. To do that, you can make at most 10 queries of... | 2
1
YES
0
2
YES
| ? 0 ! 1 ? 0 ? 19997 ! 5982 | 3 seconds | 1024 megabytes | ['brute force', 'games', 'implementation', 'interactive', '*2500'] |
H. Hot and Coldtime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputThis is an interactive problem.After emigrating to another country, little Hanna came across the fact that playing "Hot and cold" became more difficult: she does not understand the hint phrases! You are... |
Tabilmadi
Daha yakin
Daha yakin
Sama distanco
Dalej
Znaydeno! | 500 200 560 230 566 240 566 238 30 239 566 239 | 3 seconds | 1024 megabytes | ['binary search', 'interactive', '*2600'] |
G. Game of Questionstime limit per test5 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputGenie is taking part in an intellectual game. The game consists of n questions, and there are m participants numbered from 1 to m. Genie is the participant number 1.For each question i and particip... | 1 5
11010
| 1.0000000000000000 | 5 seconds | 1024 megabytes | ['bitmasks', 'combinatorics', 'dp', 'fft', 'math', 'probabilities', '*2800'] |
F. Footballtime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputScientists are researching an impact of football match results on the mood of football fans. They have a hypothesis that there is a correlation between the number of draws and fans' desire to watch football... | 3
2
4
| 0 1:0 1:2 0:2 | 3 seconds | 1024 megabytes | ['constructive algorithms', '*800'] |
E. Easy Assemblytime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputEmma loves playing with blocks. She has several cubic blocks of the same size that are numbered with distinct integers written on them. She assembles towers from those blocks by stacking them verticall... | 2
3 3 5 8
2 9 2
| 1 2 | 3 seconds | 1024 megabytes | ['greedy', 'sortings', '*1400'] |
D. Dominoestime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputDora likes to play with dominoes. She takes n \times m table, marks some cells as occupied, and then tries to fill all unoccupied cells with 2 \times 1 dominoes. Her little brother Dani loves to play prank... | 3 6
...#..
......
#...##
| 52 | 3 seconds | 1024 megabytes | ['combinatorics', 'flows', 'graph matchings', 'greedy', '*2600'] |
B. BinCointime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputThere are n employees in the BinCoin company numbered from 1 to n. The subordination structure in this company is a rooted tree. In other words: There is one CEO in the company — the main boss. Each other... | 3 50
1 2 3 1 2 3 3 2 1 1 2 3
3 2 1 1 2 3 1 2 3 1 2 3
1 2 3 3 2 1 1 2 3 3 2 1
1 2 3 3 2 1 1 2 3 3 2 1
1 2 3 1 2 3 3 2 1 1 2 3
3 2 1 1 2 3 3 2 1 1 2 3
1 2 3 3 2 1 1 2 3 1 2 3
1 2 3 1 2 3 3 2 1 1 2 3
3 2 1 3 2 1 1 2 3 3 2 1
1 2 3 3 2 1 ... | 2 -1 2 | 3 seconds | 1024 megabytes | ['binary search', 'divide and conquer', 'hashing', 'implementation', 'probabilities', 'trees', '*2200'] |
A. Amazing Tricktime limit per test3 secondsmemory limit per test1024 megabytesinputstandard inputoutputstandard outputAlice is a magician and she creates a new trick. She has n cards with different numbers from 1 to n written on them. First, she asks an audience member to shuffle the deck and put cards in a row. Let's... | 422 131 2 342 1 4 355 1 4 2 3 | Impossible Possible 3 1 2 2 3 1 Possible 3 4 2 1 3 4 2 1 Possible 4 1 2 5 3 3 1 4 5 2 | 3 seconds | 1024 megabytes | ['constructive algorithms', 'graph matchings', 'math', 'probabilities', '*1900'] |
G. Gaining Ratingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMonocarp is playing chess on one popular website. He has n opponents he can play with. The i-th opponent has rating equal to a_i. Monocarp's initial rating is x. Monocarp wants to raise his rating to t... | 37 2 103 1 9 2 5 20 87 1 103 1 9 2 5 20 85 10 12100 1 200 11 300 | 20 -1 2 | 2 seconds | 256 megabytes | ['binary search', 'greedy', 'implementation', 'math', 'sortings', 'two pointers', '*2200'] |
F. Copy of a Copy of a Copytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt all started with a black-and-white picture, that can be represented as an n \times m matrix such that all its elements are either 0 or 1. The rows are numbered from 1 to n, the columns are... | 3 3 1
010
111
010
010
101
010
| 2 2 1 2 2 2 1 | 2 seconds | 256 megabytes | ['constructive algorithms', 'dfs and similar', 'graphs', 'implementation', 'sortings', '*2000'] |
E. Permutation Gametime limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputTwo players are playing a game. They have a permutation of integers 1, 2, ..., n (a permutation is an array where each element from 1 to n occurs exactly once). The permutation is not sorted in eithe... | 441 2 4 332 3 153 4 5 2 161 5 6 3 2 4 | First Tie Second Tie | 4 seconds | 256 megabytes | ['games', '*1700'] |
D. Absolute Sortingtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n integers. The array is sorted if a_1 \le a_2 \le \dots \le a_n.You want to make the array a sorted by applying the following operation exactly once: choose a... | 855 3 3 3 545 3 4 581 2 3 4 5 6 7 8610 5 4 3 2 133 3 1342 43 422100000000 99999999629613295 52036613 75100585 78027446 81409090 73215 | 4 -1 0 42 2 -1 100000000 40741153 | 2 seconds | 512 megabytes | ['constructive algorithms', 'math', '*1400'] |
C. Different Differencestime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAn array a consisting of k integers is strictly increasing if a_1 < a_2 < \dots < a_k. For example, the arrays [1, 3, 5], [1, 2, 3, 4], [3, 5, 6] are strictly increasing; the arrays [2, 2], [3, ... | 75 94 123 33 44 44 68 11 | 1 3 4 7 8 2 4 7 12 1 2 3 1 3 4 1 2 3 4 2 4 5 6 1 2 3 5 6 7 8 11 | 2 seconds | 512 megabytes | ['constructive algorithms', 'greedy', 'math', '*1000'] |
B. Matrix Rotationtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou have a matrix 2 \times 2 filled with distinct integers. You want your matrix to become beautiful. The matrix is beautiful if the following two conditions are satisfied: in each row, the first ele... | 61 35 78 103 48 104 36 19 27 54 21 24 3 | YES YES NO YES YES NO | 2 seconds | 512 megabytes | ['brute force', 'implementation', '*800'] |
A. A+B?time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputYou are given an expression of the form a{+}b, where a and b are integers from 0 to 9. You have to evaluate it and print the result.InputThe first line contains one integer t (1 \le t \le 100) — the number of te... | 44+20+03+78+9 | 6 0 10 17 | 2 seconds | 512 megabytes | ['implementation', '*800'] |
F. Hossam and Range Minimum Querytime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHossam gives you a sequence of integers a_1, \, a_2, \, \dots, \, a_n of length n. Moreover, he will give you q queries of type (l, \, r). For each query, consider the elements a_l, \... | 5
1 2 1 2 2
6
1 2
0 2
0 6
0 5
2 2
3 7
| 1 2 1 0 2 2 | 1.5 seconds | 256 megabytes | ['binary search', 'bitmasks', 'data structures', 'hashing', 'probabilities', 'strings', 'trees', '*2500'] |
E. Hossam and a Lettertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHossam bought a new piece of ground with length n and width m, he divided it into an n \cdot m grid, each cell being of size 1\times1.Since Hossam's name starts with the letter 'H', he decided to ... | 2 3
#m.
.#.
| 0 | 2 seconds | 256 megabytes | ['brute force', 'dp', 'implementation', 'two pointers', '*2500'] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.