andylizf commited on
Commit
421312b
·
verified ·
1 Parent(s): 473107a

Update dataset

Browse files
Files changed (2) hide show
  1. README.md +2 -2
  2. data/test-00000-of-00001.json +0 -1
README.md CHANGED
@@ -19,8 +19,8 @@ A benchmark dataset for evaluating AI systems on challenging computer science pr
19
 
20
  ## Dataset Description
21
 
22
- This dataset contains 208 problems across two categories:
23
- - **Algorithmic**: 145 competitive programming problems with automated judging
24
  - **Research**: 63 open-ended research problems
25
 
26
  ## Dataset Structure
 
19
 
20
  ## Dataset Description
21
 
22
+ This dataset contains 207 problems across two categories:
23
+ - **Algorithmic**: 144 competitive programming problems with automated judging
24
  - **Research**: 63 open-ended research problems
25
 
26
  ## Dataset Structure
data/test-00000-of-00001.json CHANGED
@@ -82,7 +82,6 @@
82
  {"problem_id": "220", "category": "algorithmic", "statement": "Playing Around the Table\n\n## Problem Description\n\nThere are n players, numbered from 1 to n sitting around a round table. The (i+1)-th player sits to the right of the i-th player for 1≤i<n, and the 1-st player sits to the right of the n-th player.\n\nThere are n^2 cards, each of which has an integer between 1 and n written on it. For each integer from 1 to n, there are exactly n cards having this number.\n\nInitially, all these cards are distributed among all the players, in such a way that each of them has exactly n cards. In one operation, each player chooses one of his cards and passes it to the player to his right. All these actions are performed simultaneously.\n\nPlayer i is called solid if all his cards have the integer i written on them. Their objective is to reach a configuration in which everyone is solid. Find a way to do it using at most (n^2−n) operations.\n\n## Input Format\n\nThe first line contains a single integer n (2≤n≤100).\n\nThen n lines follow. The i-th of them contains n integers c1,c2,…,cn (1≤cj≤n) — the initial cards of the i-th player.\n\nIt is guaranteed that for each integer i from 1 to n, there are exactly n cards having the number i.\n\n## Output Format\n\nIn the first line print an integer k (0≤k≤(n^2−n)) — the numbers of operations you want to make.\n\nThen k lines should follow. In the i-th of them print n integers d1,d2,…,dn (1≤dj≤n) where dj is the number written on the card which j-th player passes to the player to his right in the i-th operation.\n\nWe can show that an answer always exists under the given constraints. If there are multiple answers, print any.\n\n## Example\n\n### Input\n\n```\n2\n2 1\n1 2\n```\n\n### Output\n\n```\n1\n2 1\n```\n\n### Input\n\n```\n3\n1 1 1\n2 2 2\n3 3 3\n```\n\n### Output\n\n```\n6\n1 2 3\n3 1 2\n2 3 1\n1 2 3\n3 1 2\n2 3 1\n```\n\n## Note\n\nIn the first test case, if the first player passes a card with number 2 and the second player passes a card with number 1, then the first player has two cards with number 1 and the second player has two cards with number 2. Then, after making this operation, both players are solid.\n\nIn the second test case, 0 operations would be enough too. Note that you do not need to minimize the number of operations.\n\n## Constraints\n\n- 2 ≤ n ≤ 100\n- For each integer i from 1 to n, there are exactly n cards having the number i\n\n## Time Limit\n\n2 seconds per test case\n\n## Memory Limit\n\n256 MB", "config": "# Set the problem type to default (submit answer problems use default type)\ntype: default\n\n# Specify the checker source file\nchecker: chk.cc\n\n# Time and memory limits (for submit answer problems, these may not be strictly enforced)\ntime: 2s\nmemory: 256m\n\n# The subtasks section\nsubtasks:\n - score: 100\n n_cases: 4 # Test cases: 1.in, 2.in, ..., 10.in in testdata/\n"}
83
  {"problem_id": "222", "category": "algorithmic", "statement": "Problem: Hedgehog Graph\n\nTime limit: 5 seconds\n\nMemory limit: 1024 megabytes\n\nThis is an interactive problem.\n\nA hedgehog graph is a directed graph where each vertex has exactly one outgoing edge and contains exactly one directed cycle of length at least 3 (the graph does not contain a loop or cycle of length 2).\nFor every edge e = u -> v in the hedgehog graph, v belongs to the aforementioned single directed cycle.\n\nFor a vertex v, if there exists an edge v -> w we denote the vertex w = next(v) as the next vertex. This vertex exists and is unique.\n\nKipa has n hedgehog graphs with 10^6 vertices. Each vertex is numbered from 1 to 10^6.\nKipa is not given the graph directly. Instead, Kipa can ask queries to explore the graph.\n\nYour task is to help Kipa determine the length of the directed cycle for each hedgehog graph.\n\nInteraction Protocol\n\nFirst, your program must read from the standard input one line with the positive integer n, the number of graphs to process. n will be at most 10.\n\nFor each graph, the program can ask the following query at most 2500 times:\n ? v x\n Given a vertex v and a positive integer x, the jury starts at v, moves to the next vertex x times, and returns the index of the resulting vertex.\n (1 <= v <= 10^6, 1 <= x <= 5 * 10^18)\n\nOnce you have determined the length of the cycle s, output:\n ! s\n\nAfter that, read a single integer which is either:\n 1, if the answer is correct. You should immediately start processing the next graph, or finish your program with the exit code 0 if all n graphs are processed.\n -1, if the answer is incorrect. In this case, you should finish your program with exit code 0, in which case you will receive a Wrong Answer verdict.\n\nFailure to handle this properly may result in unexpected behavior. You must flush your output after every interaction.\n\nThe interactor is adaptive. The interactor does not necessarily start with a fixed graph at the beginning of the interaction. It only guarantees that there exists at least one hedgehog graph that satisfies all the provided responses and the input specification.\n\nScoring\n\nThe problem uses a continuous scoring system based on the number of queries Q used to solve each graph. The final score for a test is the average of the scores for each of the n graphs.\n\nFor a single graph, let Q be the number of queries used. The score S(Q) is calculated as follows:\n\n1. If Q <= 500:\n S(Q) = 100 points.\n\n2. If 500 < Q < 2500:\n The score follows a quadratic curve (x^2), decreasing as Q increases:\n S(Q) = floor( 100 * ( (2500 - Q) / 2000 )^2 )\n\n3. If Q >= 2500:\n S(Q) = 0 points.\n\nNote: If you provide an incorrect cycle length, you will receive 0 points and a Wrong Answer verdict immediately.\n\nExample Input:\n1\n3\n7\n10\n1\n\nExample Output:\n? 1 2\n? 2 5\n? 10 11\n! 11", "config": "# Set the problem type to interactive\ntype: interactive\n\n# Specify the interactor source file\ninteractor: interactor.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 5s\nmemory: 1024m\n\n# The subtasks section works the same way\nsubtasks:\n - score: 100\n n_cases: 1 # Looks for 1.in, 2.in, ... 5.in\n"}
84
  {"problem_id": "225", "category": "algorithmic", "statement": "You are given a permutation $a_1, a_2, \\dots, a_n$ of numbers from $1$ to $n$.\nAlso, you have $n$ sets $S_1, S_2, \\dots, S_n$, where $S_i = \\{a_i\\}$.\nLastly, you have a variable $cnt$, representing the current number of sets.\nInitially, $cnt = n$.\n\nWe define two kinds of functions on sets:\n\n- $f(S) = \\min_{u \\in S} u$;\n- $g(S) = \\max_{u \\in S} u$.\n\nYou can obtain a new set by merging two sets $A$ and $B$, if they satisfy $g(A) < f(B)$\n(notice that the old sets do not disappear).\n\nFormally, you can perform the following operation:\n\n- $cnt \\leftarrow cnt + 1$\n- $S_{cnt} = S_u \\cup S_v$\n\nwhere you are free to choose $u$ and $v$ for which $1 \\le u, v < cnt$ and which satisfy\n$g(S_u) < f(S_v)$.\n\nYou are required to obtain some specific sets.\n\nThere are $q$ requirements, each of which contains two integers $l_i, r_i$, which means that there must exist\na set $S_{k_i}$ (where $k_i$ is the ID of the set, you should determine it) which equals\n$\\{a_u \\mid l_i \\le u \\le r_i\\}$, i.e. the set consisting of all $a_u$ with indices between $l_i$ and $r_i$.\n\nIn the end you must ensure that $\\mathrm{cnt} \\le 2.2 \\times 10^6$. Note that you don't have to minimize\n$\\mathrm{cnt}$. It is guaranteed that a solution under given constraints exists.\n\n## Input format\n- The first line contains two integers $n, q$ ($1 \\le n \\le 2^{12}$, $1 \\le q \\le 2^{16}$) — the length of\n the permutation and the number of needed sets respectively.\n- The next line consists of $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le n$, $a_i$ are pairwise distinct)\n — the given permutation.\n- The $i$-th of the next $q$ lines contains two integers $l_i, r_i$ ($1 \\le l_i \\le r_i \\le n$), describing a\n requirement of the $i$-th set.\n\n## Output format\n\n- The first line should contain one integer $cnt_E$ ($n \\le cnt_E \\le 2.2 \\times 10^6$),\n representing the number of sets after all operations.\n- $cnt_E - n$ lines must follow, each line should contain two integers $u, v$\n ($1 \\le u, v \\le cnt'$, where $cnt'$ is the value of $cnt$ before this operation),\n meaning that you choose $S_u, S_v$ and perform a merging operation. In an operation, $g(S_u) < f(S_v)$ must\n be satisfied.\n- The last line should contain $q$ integers $k_1, k_2, \\dots, k_q$ ($1 \\le k_i \\le cnt_E$), representing\n that set $S_{k_i}$ is the $i$-th required set.\n\n\n## Scoring \n- It is guaranteed that a solution under given constraints exists.\n- If the output is invalid, your score is 0.\n- Otherwise, your score is calculated as follows:\n - Let $cnt_E$ be the number of sets after all operations.\n - Your score is $\\frac{cnt_E}{2.2 \\times 10^6}$.\n", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 4s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}
85
- {"problem_id": "226", "category": "algorithmic", "statement": "Let's call a set of positive integers $S$ **correct** if the following two conditions are met:\n\n- $S \\subseteq \\{1, 2, \\dots, n\\}$;\n- If $a \\in S$ and $b \\in S$, then $|a-b| \\ne x$ and $|a-b| \\ne y$.\n\nFor the given values $n$, $x$, and $y$, you have to find the maximum size of a correct set.\n\n## Input format\n- A single line contains three integers $n$, $x$ and $y$ ($1 \\le n \\le 10^9$; $1 \\le x, y \\le 2^{22}$).\n\n## Output format\n- Print one integer — the maximum size of a correct set.\n\n## Scoring \n- Assume the ground truth answer is $ans$, and your answer is $cnt$.\n- Your score is $max(0, 1 - \\log_{10}(abs(cnt - ans) + 1) / 10)$.", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 0.5s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}
86
  {"problem_id": "227", "category": "algorithmic", "statement": "Given a permutation $p$ of length $n$, you need to divide it into four disjoint subsequences $a$ $b$ $c$ $d$ such that the sum of $\\operatorname{LIS}(a) + \\operatorname{LDS}(b) + \\operatorname{LIS}(c) + \\operatorname{LDS}(d)$ is maximized.\n\n- $\\operatorname{LIS}(a)$ is the length of the Longest Increasing Subsequence (LIS) of $a$.\n- $\\operatorname{LDS}(b)$ is the length of the Longest Decreasing Subsequence (LDS) of $b$.\n\nA permutation of length $n$ is a sequence that contains every integer from $1$ to $n$ exactly once.\n\nA subsequence of a sequence is a sequence formed by deleting any number of elements (including zero or all elements) while maintaining the order of the remaining elements. The subsequences $a$ and $b$ are disjoint, meaning they do not share any elements.\n\n## Input format\n- The first line contains an integer $n$, the length of the permutation $p$.\n- The second line contains $n$ integers $p_1, p_2, p_3, \\dots, p_n$, the permutation $p$.\n\n## Output format\n- The first line contains four integers $r, s, p, q$, the lengths of the subsequences $a, b, c, d$.\n- The second line contains $r$ integers $a_1, a_2, a_3, \\dots, a_r$, the subsequence $a$.\n- The third line contains $s$ integers $b_1, b_2, b_3, \\dots, b_s$, the subsequence $b$.\n- The fourth line contains $p$ integers $c_1, c_2, c_3, \\dots, c_p$, the subsequence $c$.\n- The fifth line contains $q$ integers $d_1, d_2, d_3, \\dots, d_q$, the subsequence $d$.\n- $r, s, p, q$ must satisfy $r + s + p + q = n$\n- $a, b, c, d$ must be disjoint subsequences of $p$\n\n## Constraints\n- $1 \\leq n \\leq 100000$\n- $p$ is a permutation of length $n$\n\n\nScoring\n- If your output is invalid, your score is 0. \n- Otherwise, let $a, b, c, d$ be the lengths of the subsequences $a, b, c, d$ and $n$ be the length of the permutation $p$.\n Your score is equal to: \n\n $\\operatorname{LIS}(a) + \\operatorname{LDS}(b) + \\operatorname{LIS}(c) + \\operatorname{LDS}(d)$ / $n$", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 2s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}
87
  {"problem_id": "228", "category": "algorithmic", "statement": "You are given a 01-string (a string consisting only of characters '0' and '1').\n\nYou need to find the number of substrings such that the number of '0's in the substring is equal to the square of the number of '1's.\n\n### Input\nA single line containing a 01-string.\nThe length of the string is at most $2 \\times 10^6$.\n\n### Output\nOutput a single line containing the answer.\n\n### Scoring\n- Assume the ground truth answer is $ans$, and your answer is $cnt$.\n- Your score is $max(0, 1 - \\log_2(abs(cnt - ans) + 1) / 10)$. ", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 1s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}
88
  {"problem_id": "229", "category": "algorithmic", "statement": "Farmer John has found historical data from $n$ consecutive days. The temperature on the $i$-th day was $t_i$. He decides to make an analysis of historical temperatures and find a subsequence of days (not necessarily consecutive) where the temperature is strictly increasing.\n\nFormally, FJ is interested in finding the length of the longest increasing subsequence (LIS) of $(t_1, t_2, \\dots , t_n)$, that is, the largest possible $k$ for which it is possible to choose an increasing sequence of indices $1 \\leq a_1 < a_2 < \\dots < a_k \\leq n$ such that $t_{a_1} < t_{a_2} < . . . < t_{a_k}$.\n\nFJ wants to find a really long subsequence and that is why he decided to cheat a bit. In one operation, he can choose a non-empty interval of days and an integer $d$ $(-x \\leq d \\leq x)$ and he will increase the temperature in each of those days by $d$. It is allowed to choose $d = 0$.\nWhat is the largest possible length of the LIS after 10 such operations?\n\n### Input Format\n\n- The first line of the input contains two space-separated integers $n$ and $x$ $(1 \\leq n \\leq 200000, 0 \\leq x \\leq 10^9)$, the number of days and the limit for the absolute value of $d$.\n- The second line contains $n$ integers $t_1, t_2, \\dots , t_n$ $(1 \\leq t_i \\leq 10^9 )$ separated by spaces, the sequence of historical temperatures.\n\n### Output Format\n\n- The output should contain 11 lines\n- The first line should contain the largest possible length of the LIS after 10 changes\n- For each of the next lines, $i$-th line should contain three integers $l$, $r$, $d$ $(1 \\leq l \\leq r \\leq n, -x \\leq d \\leq x)$, the interval of days and the change in temperature.\n\n\n### Scoring \n- Assume the longest LIS you find after 10 changes is $len$. Your score will be $\\frac{len}{n}$ if your output is valid, otherwise 0.", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 2s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}
 
82
  {"problem_id": "220", "category": "algorithmic", "statement": "Playing Around the Table\n\n## Problem Description\n\nThere are n players, numbered from 1 to n sitting around a round table. The (i+1)-th player sits to the right of the i-th player for 1≤i<n, and the 1-st player sits to the right of the n-th player.\n\nThere are n^2 cards, each of which has an integer between 1 and n written on it. For each integer from 1 to n, there are exactly n cards having this number.\n\nInitially, all these cards are distributed among all the players, in such a way that each of them has exactly n cards. In one operation, each player chooses one of his cards and passes it to the player to his right. All these actions are performed simultaneously.\n\nPlayer i is called solid if all his cards have the integer i written on them. Their objective is to reach a configuration in which everyone is solid. Find a way to do it using at most (n^2−n) operations.\n\n## Input Format\n\nThe first line contains a single integer n (2≤n≤100).\n\nThen n lines follow. The i-th of them contains n integers c1,c2,…,cn (1≤cj≤n) — the initial cards of the i-th player.\n\nIt is guaranteed that for each integer i from 1 to n, there are exactly n cards having the number i.\n\n## Output Format\n\nIn the first line print an integer k (0≤k≤(n^2−n)) — the numbers of operations you want to make.\n\nThen k lines should follow. In the i-th of them print n integers d1,d2,…,dn (1≤dj≤n) where dj is the number written on the card which j-th player passes to the player to his right in the i-th operation.\n\nWe can show that an answer always exists under the given constraints. If there are multiple answers, print any.\n\n## Example\n\n### Input\n\n```\n2\n2 1\n1 2\n```\n\n### Output\n\n```\n1\n2 1\n```\n\n### Input\n\n```\n3\n1 1 1\n2 2 2\n3 3 3\n```\n\n### Output\n\n```\n6\n1 2 3\n3 1 2\n2 3 1\n1 2 3\n3 1 2\n2 3 1\n```\n\n## Note\n\nIn the first test case, if the first player passes a card with number 2 and the second player passes a card with number 1, then the first player has two cards with number 1 and the second player has two cards with number 2. Then, after making this operation, both players are solid.\n\nIn the second test case, 0 operations would be enough too. Note that you do not need to minimize the number of operations.\n\n## Constraints\n\n- 2 ≤ n ≤ 100\n- For each integer i from 1 to n, there are exactly n cards having the number i\n\n## Time Limit\n\n2 seconds per test case\n\n## Memory Limit\n\n256 MB", "config": "# Set the problem type to default (submit answer problems use default type)\ntype: default\n\n# Specify the checker source file\nchecker: chk.cc\n\n# Time and memory limits (for submit answer problems, these may not be strictly enforced)\ntime: 2s\nmemory: 256m\n\n# The subtasks section\nsubtasks:\n - score: 100\n n_cases: 4 # Test cases: 1.in, 2.in, ..., 10.in in testdata/\n"}
83
  {"problem_id": "222", "category": "algorithmic", "statement": "Problem: Hedgehog Graph\n\nTime limit: 5 seconds\n\nMemory limit: 1024 megabytes\n\nThis is an interactive problem.\n\nA hedgehog graph is a directed graph where each vertex has exactly one outgoing edge and contains exactly one directed cycle of length at least 3 (the graph does not contain a loop or cycle of length 2).\nFor every edge e = u -> v in the hedgehog graph, v belongs to the aforementioned single directed cycle.\n\nFor a vertex v, if there exists an edge v -> w we denote the vertex w = next(v) as the next vertex. This vertex exists and is unique.\n\nKipa has n hedgehog graphs with 10^6 vertices. Each vertex is numbered from 1 to 10^6.\nKipa is not given the graph directly. Instead, Kipa can ask queries to explore the graph.\n\nYour task is to help Kipa determine the length of the directed cycle for each hedgehog graph.\n\nInteraction Protocol\n\nFirst, your program must read from the standard input one line with the positive integer n, the number of graphs to process. n will be at most 10.\n\nFor each graph, the program can ask the following query at most 2500 times:\n ? v x\n Given a vertex v and a positive integer x, the jury starts at v, moves to the next vertex x times, and returns the index of the resulting vertex.\n (1 <= v <= 10^6, 1 <= x <= 5 * 10^18)\n\nOnce you have determined the length of the cycle s, output:\n ! s\n\nAfter that, read a single integer which is either:\n 1, if the answer is correct. You should immediately start processing the next graph, or finish your program with the exit code 0 if all n graphs are processed.\n -1, if the answer is incorrect. In this case, you should finish your program with exit code 0, in which case you will receive a Wrong Answer verdict.\n\nFailure to handle this properly may result in unexpected behavior. You must flush your output after every interaction.\n\nThe interactor is adaptive. The interactor does not necessarily start with a fixed graph at the beginning of the interaction. It only guarantees that there exists at least one hedgehog graph that satisfies all the provided responses and the input specification.\n\nScoring\n\nThe problem uses a continuous scoring system based on the number of queries Q used to solve each graph. The final score for a test is the average of the scores for each of the n graphs.\n\nFor a single graph, let Q be the number of queries used. The score S(Q) is calculated as follows:\n\n1. If Q <= 500:\n S(Q) = 100 points.\n\n2. If 500 < Q < 2500:\n The score follows a quadratic curve (x^2), decreasing as Q increases:\n S(Q) = floor( 100 * ( (2500 - Q) / 2000 )^2 )\n\n3. If Q >= 2500:\n S(Q) = 0 points.\n\nNote: If you provide an incorrect cycle length, you will receive 0 points and a Wrong Answer verdict immediately.\n\nExample Input:\n1\n3\n7\n10\n1\n\nExample Output:\n? 1 2\n? 2 5\n? 10 11\n! 11", "config": "# Set the problem type to interactive\ntype: interactive\n\n# Specify the interactor source file\ninteractor: interactor.cc\n\n# Time and memory limits still apply to the contestant's solution\ntime: 5s\nmemory: 1024m\n\n# The subtasks section works the same way\nsubtasks:\n - score: 100\n n_cases: 1 # Looks for 1.in, 2.in, ... 5.in\n"}
84
  {"problem_id": "225", "category": "algorithmic", "statement": "You are given a permutation $a_1, a_2, \\dots, a_n$ of numbers from $1$ to $n$.\nAlso, you have $n$ sets $S_1, S_2, \\dots, S_n$, where $S_i = \\{a_i\\}$.\nLastly, you have a variable $cnt$, representing the current number of sets.\nInitially, $cnt = n$.\n\nWe define two kinds of functions on sets:\n\n- $f(S) = \\min_{u \\in S} u$;\n- $g(S) = \\max_{u \\in S} u$.\n\nYou can obtain a new set by merging two sets $A$ and $B$, if they satisfy $g(A) < f(B)$\n(notice that the old sets do not disappear).\n\nFormally, you can perform the following operation:\n\n- $cnt \\leftarrow cnt + 1$\n- $S_{cnt} = S_u \\cup S_v$\n\nwhere you are free to choose $u$ and $v$ for which $1 \\le u, v < cnt$ and which satisfy\n$g(S_u) < f(S_v)$.\n\nYou are required to obtain some specific sets.\n\nThere are $q$ requirements, each of which contains two integers $l_i, r_i$, which means that there must exist\na set $S_{k_i}$ (where $k_i$ is the ID of the set, you should determine it) which equals\n$\\{a_u \\mid l_i \\le u \\le r_i\\}$, i.e. the set consisting of all $a_u$ with indices between $l_i$ and $r_i$.\n\nIn the end you must ensure that $\\mathrm{cnt} \\le 2.2 \\times 10^6$. Note that you don't have to minimize\n$\\mathrm{cnt}$. It is guaranteed that a solution under given constraints exists.\n\n## Input format\n- The first line contains two integers $n, q$ ($1 \\le n \\le 2^{12}$, $1 \\le q \\le 2^{16}$) — the length of\n the permutation and the number of needed sets respectively.\n- The next line consists of $n$ integers $a_1, a_2, \\dots, a_n$ ($1 \\le a_i \\le n$, $a_i$ are pairwise distinct)\n — the given permutation.\n- The $i$-th of the next $q$ lines contains two integers $l_i, r_i$ ($1 \\le l_i \\le r_i \\le n$), describing a\n requirement of the $i$-th set.\n\n## Output format\n\n- The first line should contain one integer $cnt_E$ ($n \\le cnt_E \\le 2.2 \\times 10^6$),\n representing the number of sets after all operations.\n- $cnt_E - n$ lines must follow, each line should contain two integers $u, v$\n ($1 \\le u, v \\le cnt'$, where $cnt'$ is the value of $cnt$ before this operation),\n meaning that you choose $S_u, S_v$ and perform a merging operation. In an operation, $g(S_u) < f(S_v)$ must\n be satisfied.\n- The last line should contain $q$ integers $k_1, k_2, \\dots, k_q$ ($1 \\le k_i \\le cnt_E$), representing\n that set $S_{k_i}$ is the $i$-th required set.\n\n\n## Scoring \n- It is guaranteed that a solution under given constraints exists.\n- If the output is invalid, your score is 0.\n- Otherwise, your score is calculated as follows:\n - Let $cnt_E$ be the number of sets after all operations.\n - Your score is $\\frac{cnt_E}{2.2 \\times 10^6}$.\n", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 4s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}
 
85
  {"problem_id": "227", "category": "algorithmic", "statement": "Given a permutation $p$ of length $n$, you need to divide it into four disjoint subsequences $a$ $b$ $c$ $d$ such that the sum of $\\operatorname{LIS}(a) + \\operatorname{LDS}(b) + \\operatorname{LIS}(c) + \\operatorname{LDS}(d)$ is maximized.\n\n- $\\operatorname{LIS}(a)$ is the length of the Longest Increasing Subsequence (LIS) of $a$.\n- $\\operatorname{LDS}(b)$ is the length of the Longest Decreasing Subsequence (LDS) of $b$.\n\nA permutation of length $n$ is a sequence that contains every integer from $1$ to $n$ exactly once.\n\nA subsequence of a sequence is a sequence formed by deleting any number of elements (including zero or all elements) while maintaining the order of the remaining elements. The subsequences $a$ and $b$ are disjoint, meaning they do not share any elements.\n\n## Input format\n- The first line contains an integer $n$, the length of the permutation $p$.\n- The second line contains $n$ integers $p_1, p_2, p_3, \\dots, p_n$, the permutation $p$.\n\n## Output format\n- The first line contains four integers $r, s, p, q$, the lengths of the subsequences $a, b, c, d$.\n- The second line contains $r$ integers $a_1, a_2, a_3, \\dots, a_r$, the subsequence $a$.\n- The third line contains $s$ integers $b_1, b_2, b_3, \\dots, b_s$, the subsequence $b$.\n- The fourth line contains $p$ integers $c_1, c_2, c_3, \\dots, c_p$, the subsequence $c$.\n- The fifth line contains $q$ integers $d_1, d_2, d_3, \\dots, d_q$, the subsequence $d$.\n- $r, s, p, q$ must satisfy $r + s + p + q = n$\n- $a, b, c, d$ must be disjoint subsequences of $p$\n\n## Constraints\n- $1 \\leq n \\leq 100000$\n- $p$ is a permutation of length $n$\n\n\nScoring\n- If your output is invalid, your score is 0. \n- Otherwise, let $a, b, c, d$ be the lengths of the subsequences $a, b, c, d$ and $n$ be the length of the permutation $p$.\n Your score is equal to: \n\n $\\operatorname{LIS}(a) + \\operatorname{LDS}(b) + \\operatorname{LIS}(c) + \\operatorname{LDS}(d)$ / $n$", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 2s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}
86
  {"problem_id": "228", "category": "algorithmic", "statement": "You are given a 01-string (a string consisting only of characters '0' and '1').\n\nYou need to find the number of substrings such that the number of '0's in the substring is equal to the square of the number of '1's.\n\n### Input\nA single line containing a 01-string.\nThe length of the string is at most $2 \\times 10^6$.\n\n### Output\nOutput a single line containing the answer.\n\n### Scoring\n- Assume the ground truth answer is $ans$, and your answer is $cnt$.\n- Your score is $max(0, 1 - \\log_2(abs(cnt - ans) + 1) / 10)$. ", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 1s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}
87
  {"problem_id": "229", "category": "algorithmic", "statement": "Farmer John has found historical data from $n$ consecutive days. The temperature on the $i$-th day was $t_i$. He decides to make an analysis of historical temperatures and find a subsequence of days (not necessarily consecutive) where the temperature is strictly increasing.\n\nFormally, FJ is interested in finding the length of the longest increasing subsequence (LIS) of $(t_1, t_2, \\dots , t_n)$, that is, the largest possible $k$ for which it is possible to choose an increasing sequence of indices $1 \\leq a_1 < a_2 < \\dots < a_k \\leq n$ such that $t_{a_1} < t_{a_2} < . . . < t_{a_k}$.\n\nFJ wants to find a really long subsequence and that is why he decided to cheat a bit. In one operation, he can choose a non-empty interval of days and an integer $d$ $(-x \\leq d \\leq x)$ and he will increase the temperature in each of those days by $d$. It is allowed to choose $d = 0$.\nWhat is the largest possible length of the LIS after 10 such operations?\n\n### Input Format\n\n- The first line of the input contains two space-separated integers $n$ and $x$ $(1 \\leq n \\leq 200000, 0 \\leq x \\leq 10^9)$, the number of days and the limit for the absolute value of $d$.\n- The second line contains $n$ integers $t_1, t_2, \\dots , t_n$ $(1 \\leq t_i \\leq 10^9 )$ separated by spaces, the sequence of historical temperatures.\n\n### Output Format\n\n- The output should contain 11 lines\n- The first line should contain the largest possible length of the LIS after 10 changes\n- For each of the next lines, $i$-th line should contain three integers $l$, $r$, $d$ $(1 \\leq l \\leq r \\leq n, -x \\leq d \\leq x)$, the interval of days and the change in temperature.\n\n\n### Scoring \n- Assume the longest LIS you find after 10 changes is $len$. Your score will be $\\frac{len}{n}$ if your output is valid, otherwise 0.", "config": "type: default\nchecker: chk.cc\nchecker_type: testlib\n\n# Time and memory limits apply to the contestant's solution program.\ntime: 2s\nmemory: 512m\n\nsubtasks:\n - score: 100\n n_cases: 3\n"}