title
stringlengths 6
29
| time_limit
stringclasses 1
value | memory_limit
stringclasses 2
values | problem_statement
stringlengths 284
1.29k
| input
stringlengths 37
199
| output
stringlengths 9
227
| constraints
stringlengths 9
128
| example
dict | test_cases
listlengths 2
43
| category
stringclasses 11
values |
---|---|---|---|---|---|---|---|---|---|
Acyclic Graph Edges | 1.00 s | 512 MB | "Given an undirected graph, your task is to choose a direction for each edge so that the resulting d(...TRUNCATED) | "The first input line has two integers n and m: the number of nodes and edges. The nodes are numbere(...TRUNCATED) | "Print m lines describing the directions of the edges. Each line has two integers a and b: there is (...TRUNCATED) | 1 \le n \le 10^5
1 \le m \le 2 \cdot 10^5
1 \le a,b \le n | {
"input": "3 3\n1 2\n2 3\n3 1",
"output": "1 2\n3 2\n3 1"
} | [{"input":"10 100\n9 6\n6 7\n4 9\n10 3\n10 6\n9 8\n9 7\n8 10\n10 8\n10 9\n10 7\n5 3\n5 9\n1 5\n6 9\n(...TRUNCATED) | Additional Problems |
Advertisement | 1.00 s | 512 MB | "A fence consists of n vertical boards. The width of each board is 1 and their heights may vary.\nYo(...TRUNCATED) | The first input line contains an integer n: the width of the fence. | Print one integer: the maximum area of an advertisement. | 1 \le n \le 2 \cdot 10^5
1 \le k_i \le 10^9 | {
"input": "8\n4 1 5 3 3 2 4 1",
"output": "10"
} | [{"input":"10\n1 1 1 1 1 1 1 1 1 1","output":"10"},{"input":"200000\n459323372 637612283 667549121 9(...TRUNCATED) | Additional Problems |
Another Game | 1.00 s | 512 MB | "There are n heaps of coins and two players who move alternately. On each move, a player selects som(...TRUNCATED) | "The first input line contains an integer t: the number of tests. After this, t test cases are descr(...TRUNCATED) | "For each test case, print \"first\" if the first player wins the game and \"second\" if the second (...TRUNCATED) | "1 \\le t \\le 2 \\cdot 10^5\n1 \\le n \\le 2 \\cdot 10^5\n1 \\le x_i \\le 10^9\nthe sum of all n is(...TRUNCATED) | {
"input": "3\n3\n1 2 3\n2\n2 2\n4\n5 5 4 5",
"output": "first\nsecond\nfirst"
} | [{"input":"2000\n100\n90 45 47 96 95 38 48 96 52 4 59 18 4 28 86 38 22 85 83 39 17 98 48 62 27 85 24(...TRUNCATED) | Mathematics |
Apartments | 1.00 s | 512 MB | "There are n applicants and m free apartments. Your task is to distribute the apartments so that as (...TRUNCATED) | "The first input line has three integers n, m, and k: the number of applicants, the number of apartm(...TRUNCATED) | Print one integer: the number of applicants who will get an apartment. | 1 \le n, m \le 2 \cdot 10^5
0 \le k \le 10^9
1 \le a_i, b_i \le 10^9 | {
"input": "4 3 5\n60 45 80 60\n30 60 75",
"output": "2"
} | [{"input":"4 3 5\n60 45 80 60\n30 60 75","output":"2"},{"input":"10 10 0\n37 62 56 69 34 46 10 86 16(...TRUNCATED) | Sorting and Searching |
Apple Division | 1.00 s | 512 MB | "There are n apples with known weights. Your task is to divide the apples into two groups so that th(...TRUNCATED) | The first input line has an integer n: the number of apples. | Print one integer: the minimum difference between the weights of the groups. | 1 \le n \le 20
1 \le p_i \le 10^9 | {
"input": "5\n3 2 7 4 1",
"output": "1"
} | [{"input":"10\n603 324 573 493 659 521 654 70 718 257","output":"2"},{"input":"20\n934033764 7470139(...TRUNCATED) | Introductory Problems |
Apples and Bananas | 1.00 s | 512 MB | "There are n apples and m bananas, and each of them has an integer weight between 1 \\ldots k. Your (...TRUNCATED) | "The first input line contains three integers k, n and m: the number k, the number of apples and the(...TRUNCATED) | "For each integer w between 2 \\ldots 2k print the number of ways to choose an apple and a banana wh(...TRUNCATED) | 1 \le k,n,m \le 2 \cdot 10^5
1 \le a_i \le k
1 \le b_i \le k | {
"input": "5 3 4\n5 2 5\n4 3 2 3",
"output": "0 0 1 2 1 2 4 2 0"
} | [{"input":"10 10 10\n4 5 2 7 3 5 6 2 5 6\n2 3 5 6 2 2 6 3 5 3","output":"0 0 6 9 6 16 21 13 11 10 6 (...TRUNCATED) | Advanced Techniques |
Area of Rectangles | 1.00 s | 512 MB | "Given n rectangles, your task is to determine the total area of their union.\nInput\nThe first inpu(...TRUNCATED) | The first input line has an integer n: the number of rectangles. | Print the total area covered by the rectangles. | 1 \le n \le 10^5
-10^6 \le x_1 < x_2 \le 10^6
-10^6 \le y_1 < y_2 \le 10^6 | {
"input": "3\n1 3 4 5\n3 1 7 4\n5 3 8 6",
"output": "24"
} | [{"input":"50\n-81 -43 -80 -41\n-10 99 -9 100\n-32 -44 -30 -42\n49 10 51 12\n-17 -26 -16 -24\n-49 26(...TRUNCATED) | Additional Problems |
Array Description | 1.00 s | 512 MB | "You know that an array has n integers between 1 and m, and the absolute difference between two adj(...TRUNCATED) | The first input line has two integers n and m: the array size and the upper bound for each value. | Print one integer: the number of arrays modulo 10^9+7. | 1 \le n \le 10^5
1 \le m \le 100
0 \le x_i \le m | {
"input": "3 5\n2 0 2",
"output": "3"
} | [{"input":"2 3\n1 3","output":"0"},{"input":"1 5\n2","output":"1"},{"input":"100000 100\n1 0 0 0 0 0(...TRUNCATED) | Dynamic Programming |
Array Division | 1.00 s | 512 MB | "You are given an array containing n positive integers.\nYour task is to divide the array into k sub(...TRUNCATED) | "The first input line contains two integers n and k: the size of the array and the number of subarra(...TRUNCATED) | Print one integer: the maximum sum in a subarray in the optimal division. | 1 \le n \le 2 \cdot 10^5
1 \le k \le n
1 \le x_i \le 10^9 | {
"input": "5 3\n2 4 7 3 5",
"output": "8"
} | [{"input":"100 1\n879 179 364 181 12 134 508 539 847 641 281 39 316 363 975 900 649 721 53 492 567 5(...TRUNCATED) | Sorting and Searching |
Beautiful Subgrids | 1.00 s | 512 MB | "You are given an n \\times n grid whose each square is either black or white. A subgrid is called b(...TRUNCATED) | The first input line has an integer n: the size of the grid. | Print the number of beautiful subgrids. | 1 \le n \le 3000 | {
"input": "5\n00010\n11111\n00110\n11001\n00010",
"output": "4"
} | [{"input":"5\n10001\n11101\n11001\n10111\n01001","output":"12"},{"input":"3000\n00100010110110100011(...TRUNCATED) | Advanced Techniques |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
Use the Edit dataset card button to edit it.
- Downloads last month
- 40