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 |
---|---|---|---|---|---|---|
1208 | Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2) | FINISHED | False | 7500 | 170436263 | Aug. 25, 2019, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 5011 ) | D | Restore Permutation | PROGRAMMING | binary search data structures greedy implementation | 1900 |
B'An array of integers p_{1},p_{2}, ldots,p_{n} is called a permutation if it contains each number from 1 to n exactly once. For example, the following arrays are permutations: [3,1,2], [1], [1,2,3,4,5] and [4,3,1,2] . The following arrays are not permutations: [2], [1,1], [2,3,4] . There is a hidden permutation of length n . For each index i , you are given s_{i} , which equals to the sum of all p_{j} such that j < i and p_{j} < p_{i} . In other words, s_i is the sum of elements before the i -th element that are smaller than the i -th element. Your task is to restore the permutation. The first line contains a single integer n ( 1 <= n <= 2 cdot 10^{5} ) -- the size of the permutation. The second line contains n integers s_{1}, s_{2}, ldots, s_{n} ( 0 <= s_{i} <= frac{n(n-1)}{2} ). It is guaranteed that the array s corresponds to a valid permutation of length n . Print n integers p_{1}, p_{2}, ldots, p_{n} -- the elements of the restored permutation. We can show that the answer is always unique. In the first example for each i there is no index j satisfying both conditions, hence s_i are always 0 . In the second example for i = 2 it happens that j = 1 satisfies the conditions, so s_2 = p_1 . In the third example for i = 2, 3, 4 only j = 1 satisfies the conditions, so s_2 = s_3 = s_4 = 1 . For i = 5 all j = 1, 2, 3, 4 are possible, so s_5 = p_1 + p_2 + p_3 + p_4 = 10 . '... |
69357 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
64352040 | Vohumana | D | Nov. 6, 2019, 8:46 a.m. | OK | Clang++17 Diagnostics | TESTS | 32 | 326 | 7680000 | 1900 | |
63265064 | rr_ | D | Oct. 23, 2019, 11:11 p.m. | OK | D | TESTS | 32 | 249 | 11571200 | 1900 | |
59476949 | iica | D | Aug. 25, 2019, 4:04 p.m. | OK | D | TESTS | 32 | 1762 | 74035200 | 1900 | |
59494233 | rainboy | D | Aug. 25, 2019, 8:54 p.m. | OK | GNU C11 | TESTS | 32 | 732 | 6656000 | 1900 | |
59503163 | AutumnKite | D | Aug. 26, 2019, 4:21 a.m. | OK | GNU C++11 | TESTS | 32 | 93 | 3788800 | 1900 | |
59702384 | pufanyi | D | Aug. 30, 2019, 11:13 a.m. | OK | GNU C++11 | TESTS | 32 | 93 | 5632000 | 1900 | |
59498730 | yasugongshang | D | Aug. 26, 2019, 1:06 a.m. | OK | GNU C++11 | TESTS | 32 | 108 | 3993600 | 1900 | |
63224596 | LuciferX07 | D | Oct. 23, 2019, 8:54 a.m. | OK | GNU C++11 | TESTS | 32 | 108 | 4608000 | 1900 | |
63224673 | LuciferX07 | D | Oct. 23, 2019, 8:55 a.m. | OK | GNU C++11 | TESTS | 32 | 108 | 4608000 | 1900 | |
59498746 | chenyewei_1234 | D | Aug. 26, 2019, 1:07 a.m. | OK | GNU C++11 | TESTS | 32 | 108 | 5939200 | 1900 | |
59500522 | wangyc | D | Aug. 26, 2019, 2:28 a.m. | OK | GNU C++11 | TESTS | 32 | 108 | 7270400 | 1900 | |
62936749 | Binary_Search_Tree | D | Oct. 19, 2019, 2:18 p.m. | OK | GNU C++11 | TESTS | 32 | 108 | 20070400 | 1900 | |
59899961 | LanrTabe | D | Sept. 2, 2019, 1:20 p.m. | OK | GNU C++11 | TESTS | 32 | 109 | 3788800 | 1900 | |
60026049 | AutumnKite | D | Sept. 4, 2019, 2:12 p.m. | OK | GNU C++11 | TESTS | 32 | 109 | 3788800 | 1900 | |
59527735 | bbtl | D | Aug. 26, 2019, 1:57 p.m. | OK | GNU C++14 | TESTS | 32 | 124 | 3993600 | 1900 | |
59596987 | Ramprosad | D | Aug. 28, 2019, 2:42 a.m. | OK | GNU C++14 | TESTS | 32 | 124 | 3993600 | 1900 | |
60374816 | maxmin | D | Sept. 11, 2019, 5:48 a.m. | OK | GNU C++14 | TESTS | 32 | 124 | 9011200 | 1900 | |
61219107 | bnmd | D | Sept. 24, 2019, 1:29 p.m. | OK | GNU C++14 | TESTS | 32 | 139 | 3993600 | 1900 | |
60927223 | alurquiza | D | Sept. 20, 2019, 12:38 p.m. | OK | GNU C++14 | TESTS | 32 | 139 | 3993600 | 1900 | |
60424733 | vjudge5 | D | Sept. 12, 2019, 7:35 a.m. | OK | GNU C++14 | TESTS | 32 | 139 | 3993600 | 1900 | |
68912582 | vjudge2 | D | Jan. 16, 2020, 7:55 a.m. | OK | GNU C++14 | TESTS | 32 | 139 | 3993600 | 1900 | |
59501492 | ilshin | D | Aug. 26, 2019, 3:07 a.m. | OK | GNU C++14 | TESTS | 32 | 139 | 3993600 | 1900 | |
59505281 | ManhTr | D | Aug. 26, 2019, 5:45 a.m. | OK | GNU C++14 | TESTS | 32 | 139 | 3993600 | 1900 | |
59479495 | OFYM | D | Aug. 25, 2019, 4:17 p.m. | OK | GNU C++14 | TESTS | 32 | 139 | 5632000 | 1900 | |
59508599 | karin0 | D | Aug. 26, 2019, 7:07 a.m. | OK | GNU C++17 | TESTS | 32 | 93 | 6041600 | 1900 | |
59692285 | Bisnu | D | Aug. 30, 2019, 6:47 a.m. | OK | GNU C++17 | TESTS | 32 | 124 | 3993600 | 1900 | |
59595235 | nuchenghao | D | Aug. 28, 2019, 12:57 a.m. | OK | GNU C++17 | TESTS | 32 | 124 | 3993600 | 1900 | |
59709052 | H4XeO6 | D | Aug. 30, 2019, 1:53 p.m. | OK | GNU C++17 | TESTS | 32 | 124 | 4198400 | 1900 | |
59830354 | StarCuriosity | D | Aug. 31, 2019, 10:22 p.m. | OK | GNU C++17 | TESTS | 32 | 124 | 9625600 | 1900 | |
59481046 | ogino | D | Aug. 25, 2019, 4:25 p.m. | OK | GNU C++17 | TESTS | 32 | 124 | 15564800 | 1900 | |
59588766 | Priyam2k | D | Aug. 27, 2019, 7:15 p.m. | OK | GNU C++17 | TESTS | 32 | 139 | 3993600 | 1900 | |
59511940 | 08072002 | D | Aug. 26, 2019, 8:20 a.m. | OK | GNU C++17 | TESTS | 32 | 139 | 3993600 | 1900 | |
59939196 | SGHD | D | Sept. 3, 2019, 10:46 a.m. | OK | GNU C++17 | TESTS | 32 | 139 | 3993600 | 1900 | |
59596848 | nuchenghao | D | Aug. 28, 2019, 2:34 a.m. | OK | GNU C++17 | TESTS | 32 | 139 | 3993600 | 1900 | |
63782255 | IslamTalipovTop | D | Oct. 30, 2019, 11:22 a.m. | OK | Java 11 | TESTS | 32 | 530 | 15155200 | 1900 | |
59584967 | i_will_be_less_than_blue | D | Aug. 27, 2019, 5:36 p.m. | OK | Java 8 | TESTS | 32 | 186 | 0 | 1900 | |
59554960 | tmwilliamlin168 | D | Aug. 27, 2019, 5:43 a.m. | OK | Java 8 | TESTS | 32 | 217 | 0 | 1900 | |
59501056 | BiIIy | D | Aug. 26, 2019, 2:50 a.m. | OK | Java 8 | TESTS | 32 | 218 | 13414400 | 1900 | |
60344335 | polyakoff | D | Sept. 10, 2019, 12:02 p.m. | OK | Java 8 | TESTS | 32 | 218 | 14950400 | 1900 | |
61738103 | mufaddalnaya | D | Oct. 2, 2019, 7 p.m. | OK | Java 8 | TESTS | 32 | 233 | 0 | 1900 | |
60338716 | KharYusuf | D | Sept. 10, 2019, 9:48 a.m. | OK | Java 8 | TESTS | 32 | 233 | 0 | 1900 | |
59488097 | kusomushi | D | Aug. 25, 2019, 6:12 p.m. | OK | Java 8 | TESTS | 32 | 249 | 13312000 | 1900 | |
59500193 | Darth_Jar_Jar_Binks | D | Aug. 26, 2019, 2:13 a.m. | OK | Java 8 | TESTS | 32 | 249 | 13414400 | 1900 | |
60310589 | polyakoff | D | Sept. 9, 2019, 3:37 p.m. | OK | Java 8 | TESTS | 32 | 249 | 14950400 | 1900 | |
59496426 | derrick20 | D | Aug. 25, 2019, 10:41 p.m. | OK | Java 8 | TESTS | 32 | 264 | 0 | 1900 | |
61839480 | Spheniscine | D | Oct. 4, 2019, 9:08 a.m. | OK | Kotlin | TESTS | 32 | 249 | 15769600 | 1900 | |
60223160 | .tx | D | Sept. 7, 2019, 2:25 p.m. | OK | Kotlin | TESTS | 32 | 295 | 15667200 | 1900 | |
59621873 | Spheniscine | D | Aug. 28, 2019, 2:28 p.m. | OK | Kotlin | TESTS | 32 | 451 | 20070400 | 1900 | |
59620630 | Spheniscine | D | Aug. 28, 2019, 2:06 p.m. | OK | Kotlin | TESTS | 32 | 452 | 20070400 | 1900 | |
59619903 | Spheniscine | D | Aug. 28, 2019, 1:54 p.m. | OK | Kotlin | TESTS | 32 | 467 | 20070400 | 1900 | |
59623256 | Spheniscine | D | Aug. 28, 2019, 2:55 p.m. | OK | Kotlin | TESTS | 32 | 467 | 20275200 | 1900 | |
59824612 | armoking | D | Aug. 31, 2019, 6:51 p.m. | OK | Kotlin | TESTS | 32 | 498 | 20787200 | 1900 | |
59580774 | Spheniscine | D | Aug. 27, 2019, 3:57 p.m. | OK | Kotlin | TESTS | 32 | 530 | 20172800 | 1900 | |
59620445 | Benq | D | Aug. 28, 2019, 2:03 p.m. | OK | Kotlin | TESTS | 32 | 732 | 33792000 | 1900 | |
59824470 | armoking | D | Aug. 31, 2019, 6:47 p.m. | OK | Kotlin | TESTS | 32 | 1201 | 20787200 | 1900 | |
59510292 | og.kostya | D | Aug. 26, 2019, 7:44 a.m. | OK | Mono C# | TESTS | 32 | 343 | 9523200 | 1900 | |
68945239 | vjudge3 | D | Jan. 16, 2020, 3:54 p.m. | OK | MS C++ | TESTS | 32 | 171 | 3993600 | 1900 | |
65562437 | vjudge3 | D | Nov. 23, 2019, 3:52 a.m. | OK | MS C++ | TESTS | 32 | 171 | 9625600 | 1900 | |
65793198 | vjudge3 | D | Nov. 27, 2019, 1:18 a.m. | OK | MS C++ | TESTS | 32 | 186 | 9625600 | 1900 | |
60557266 | vjudge3 | D | Sept. 14, 2019, 2:27 p.m. | OK | MS C++ | TESTS | 32 | 187 | 3993600 | 1900 | |
68099585 | vjudge3 | D | Jan. 3, 2020, 1:04 a.m. | OK | MS C++ | TESTS | 32 | 202 | 4812800 | 1900 | |
61432347 | vjudge1 | D | Sept. 28, 2019, 3:12 p.m. | OK | MS C++ | TESTS | 32 | 218 | 32051200 | 1900 | |
68843398 | vjudge3 | D | Jan. 15, 2020, 6:35 a.m. | OK | MS C++ | TESTS | 32 | 327 | 41676800 | 1900 | |
59707039 | vjudge1 | D | Aug. 30, 2019, 1:06 p.m. | OK | MS C++ | TESTS | 32 | 436 | 83353600 | 1900 | |
68848094 | vjudge1 | D | Jan. 15, 2020, 8:03 a.m. | OK | MS C++ | TESTS | 32 | 639 | 9625600 | 1900 | |
60470895 | math957963 | D | Sept. 13, 2019, 5:27 a.m. | OK | MS C++ | TESTS | 32 | 1700 | 8396800 | 1900 | |
59524697 | j2v | D | Aug. 26, 2019, 1:03 p.m. | OK | MS C++ 2017 | TESTS | 32 | 186 | 10444800 | 1900 | |
65559485 | vjudge2 | D | Nov. 23, 2019, 1:51 a.m. | OK | MS C++ 2017 | TESTS | 32 | 202 | 9625600 | 1900 | |
59509995 | zcb | D | Aug. 26, 2019, 7:37 a.m. | OK | MS C++ 2017 | TESTS | 32 | 280 | 4812800 | 1900 | |
59511303 | eric161324 | D | Aug. 26, 2019, 8:06 a.m. | OK | MS C++ 2017 | TESTS | 32 | 280 | 4812800 | 1900 | |
59511264 | eric161324 | D | Aug. 26, 2019, 8:05 a.m. | OK | MS C++ 2017 | TESTS | 32 | 311 | 4812800 | 1900 | |
59684198 | j2v | D | Aug. 29, 2019, 11:32 p.m. | OK | MS C++ 2017 | TESTS | 32 | 311 | 15257600 | 1900 | |
60444533 | pmitkov | D | Sept. 12, 2019, 1:41 p.m. | OK | MS C++ 2017 | TESTS | 32 | 436 | 20889600 | 1900 | |
59521969 | j2v | D | Aug. 26, 2019, 12:11 p.m. | OK | MS C++ 2017 | TESTS | 32 | 499 | 10444800 | 1900 | |
59486308 | siwei | D | Aug. 25, 2019, 5:45 p.m. | OK | MS C++ 2017 | TESTS | 32 | 514 | 12390400 | 1900 | |
59663414 | AleksanderBalobanov | D | Aug. 29, 2019, 1:20 p.m. | OK | MS C++ 2017 | TESTS | 32 | 545 | 108236800 | 1900 | |
59503264 | alexwice | D | Aug. 26, 2019, 4:26 a.m. | OK | PyPy 2 | TESTS | 32 | 655 | 30310400 | 1900 | |
59828900 | yumtam | D | Aug. 31, 2019, 9:09 p.m. | OK | PyPy 2 | TESTS | 32 | 826 | 46592000 | 1900 | |
61243375 | aeternalis1 | D | Sept. 24, 2019, 9:18 p.m. | OK | PyPy 2 | TESTS | 32 | 1418 | 27750400 | 1900 | |
60186095 | MVP | D | Sept. 6, 2019, 6:34 p.m. | OK | PyPy 2 | TESTS | 32 | 1980 | 40857600 | 1900 | |
59526648 | takakin | D | Aug. 26, 2019, 1:37 p.m. | OK | PyPy 3 | TESTS | 32 | 935 | 31129600 | 1900 | |
59515417 | macleChen | D | Aug. 26, 2019, 9:26 a.m. | OK | PyPy 3 | TESTS | 32 | 935 | 32870400 | 1900 | |
62504638 | songzy12 | D | Oct. 13, 2019, 12:14 p.m. | OK | PyPy 3 | TESTS | 32 | 951 | 34918400 | 1900 | |
59515537 | macleChen | D | Aug. 26, 2019, 10:02 a.m. | OK | PyPy 3 | TESTS | 32 | 966 | 32870400 | 1900 | |
59504521 | Kiri8128 | D | Aug. 26, 2019, 5:17 a.m. | OK | PyPy 3 | TESTS | 32 | 966 | 33177600 | 1900 | |
59526098 | StinsonOvO | D | Aug. 26, 2019, 1:27 p.m. | OK | PyPy 3 | TESTS | 32 | 997 | 32563200 | 1900 | |
59567132 | brosucks | D | Aug. 27, 2019, 11:11 a.m. | OK | PyPy 3 | TESTS | 32 | 1231 | 39936000 | 1900 | |
59821315 | erickjohnross | D | Aug. 31, 2019, 5:27 p.m. | OK | PyPy 3 | TESTS | 32 | 1326 | 34201600 | 1900 | |
59821475 | erickjohnross | D | Aug. 31, 2019, 5:30 p.m. | OK | PyPy 3 | TESTS | 32 | 1340 | 34201600 | 1900 | |
59569835 | aberent | D | Aug. 27, 2019, 12:09 p.m. | OK | PyPy 3 | TESTS | 32 | 1450 | 62464000 | 1900 | |
59491194 | sansen | D | Aug. 25, 2019, 7:23 p.m. | OK | Rust | TESTS | 32 | 93 | 9728000 | 1900 | |
59495513 | sansen | D | Aug. 25, 2019, 9:51 p.m. | OK | Rust | TESTS | 32 | 108 | 8192000 | 1900 | |
59706788 | loujunjie | D | Aug. 30, 2019, 1:01 p.m. | OK | Rust | TESTS | 32 | 140 | 9728000 | 1900 | |
59636650 | ValenKof | D | Aug. 28, 2019, 9:09 p.m. | OK | Rust | TESTS | 32 | 156 | 14336000 | 1900 | |
59481092 | arzk | D | Aug. 25, 2019, 4:26 p.m. | OK | Rust | TESTS | 32 | 373 | 13004800 | 1900 | |
59493814 | limed | D | Aug. 25, 2019, 8:40 p.m. | OK | Scala | TESTS | 32 | 592 | 14848000 | 1900 | |
59493567 | limed | D | Aug. 25, 2019, 8:31 p.m. | OK | Scala | TESTS | 32 | 686 | 15769600 | 1900 |
Back to search problems