Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
---|---|---|---|---|---|---|
1375 | Codeforces Global Round 9 | FINISHED | False | 9000 | 143478911 | July 4, 2020, 2:45 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 441 ) | H | Set Merging | PROGRAMMING | constructive algorithms data structures divide and conquer |
B"You are given a permutation a_1, a_2, ... , a_n of numbers from 1 to n . Also, you have n sets S_1,S_2, ... , S_n , where S_i= {a_i } . Lastly, you have a variable cnt , representing the current number of sets. Initially, cnt = n . We define two kinds of functions on sets: f(S)= min limits_{u in S} u ; g(S)= max limits_{u in S} u . You can obtain a new set by merging two sets A and B , if they satisfy g(A)<f(B) (Notice that the old sets do not disappear). Formally, you can perform the following sequence of operations: cnt gets cnt+1 ; S_{cnt}=S_u cup S_v , you are free to choose u and v for which 1 <= u, v < cnt and which satisfy g(S_u)<f(S_v) . You are required to obtain some specific sets. There are q requirements, each of which contains two integers l_i , r_i , which means that there must exist a set S_{k_i} ( k_i is the ID of the set, you should determine it) which equals {a_u mid l_i <= q u <= q r_i } , which is, the set consisting of all a_i with indices between l_i and r_i . In the end you must ensure that cnt <= q 2.2 x 10^6 . Note that you don't have to minimize cnt . It is guaranteed that a solution under given constraints exists. The first line contains two integers n,q (1 <= q n <= q 2^{12},1 <= q q <= q 2^{16}) -- the length of the permutation and the number of needed sets correspondently. The next line consists of n integers a_1,a_2, cdots, a_n ( 1 <= q a_i <= q n , a_i are pairwise distinct) -- given permutation. i -th of the next q lines contains two integers l_i,r_i (1 <= q l_i <= q r_i <= q n) , describing a requirement of the i -th set. It is guaranteed that a solution under given constraints exists. The first line should contain one integer cnt_E (n <= q cnt_E <= q 2.2 x 10^6) , representing the number "... |
79731 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
86016157 | hos.lyric | H | July 5, 2020, 12:42 a.m. | OK | D | TESTS | 75 | 3868 | 267366400 | ||
86000221 | zeronumber | H | July 4, 2020, 5:58 p.m. | OK | GNU C++14 | TESTS | 75 | 764 | 100556800 | ||
86014113 | krijgertje | H | July 4, 2020, 11:01 p.m. | OK | GNU C++14 | TESTS | 75 | 779 | 164044800 | ||
85990887 | tourist | H | July 4, 2020, 4:59 p.m. | OK | GNU C++17 | TESTS | 75 | 1169 | 36454400 | ||
86005949 | Benq | H | July 4, 2020, 7:17 p.m. | OK | GNU C++17 | TESTS | 75 | 1387 | 34201600 | ||
85986287 | ksun48 | H | July 4, 2020, 4:46 p.m. | OK | GNU C++17 | TESTS | 75 | 1465 | 61132800 | ||
85979597 | Eliden | H | July 4, 2020, 4:25 p.m. | OK | GNU C++17 | TESTS | 75 | 1653 | 96153600 | ||
86007961 | GreymaneSilverfang | H | July 4, 2020, 7:54 p.m. | OK | GNU C++17 | TESTS | 75 | 2979 | 94617600 | ||
86004237 | Radewoosh | H | July 4, 2020, 6:47 p.m. | OK | GNU C++17 | TESTS | 75 | 3057 | 168652800 | ||
86009925 | rqi | H | July 4, 2020, 8:36 p.m. | OK | GNU C++17 | TESTS | 75 | 3587 | 95846400 | ||
85987937 | yosupo | H | July 4, 2020, 4:51 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 234 | 34918400 | ||
86008510 | ecnerwala | H | July 4, 2020, 8:05 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 608 | 40960000 | ||
86008417 | ecnerwala | H | July 4, 2020, 8:03 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 655 | 43827200 | ||
86003761 | DeadlyCritic | H | July 4, 2020, 6:40 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 764 | 69529600 | ||
86006440 | ecnerwala | H | July 4, 2020, 7:26 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 779 | 39014400 | ||
85997130 | tEMMIE.w. | H | July 4, 2020, 5:14 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1465 | 80076800 | ||
85998854 | Petr | H | July 4, 2020, 5:48 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1653 | 54579200 | ||
86006166 | Kuroni | H | July 4, 2020, 7:21 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 1653 | 106393600 | ||
85992909 | scott_wu | H | July 4, 2020, 5:05 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 3026 | 255897600 | ||
86001960 | scott_wu | H | July 4, 2020, 6:16 p.m. | OK | GNU C++17 (64) | TESTS | 75 | 3104 | 256000000 | ||
85996224 | qwerty787788 | H | July 4, 2020, 5:13 p.m. | OK | Java 11 | TESTS | 75 | 2339 | 268390400 |
Back to search problems