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 |
|---|---|---|---|---|---|---|
| 992 | Codeforces Round 489 (Div. 2) | FINISHED | False | 7200 | 247065923 | June 18, 2018, 4:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1673 ) | E | Nastya and King-Shamans | PROGRAMMING | binary search data structures | 2600 |
Nastya likes reading and even spends whole days in a library sometimes. Today she found a chronicle of Byteland in the library, and it stated that there lived shamans long time ago. It is known that at every moment there was exactly one shaman in Byteland, and there were n shamans in total enumerated with integers from 1 to n in the order they lived. Also, each shaman had a magic power which can now be expressed as an integer. The chronicle includes a list of powers of the n shamans. Also, some shamans can be king-shamans, if they gathered all the power of their predecessors, i.e. their power is exactly the sum of powers of all previous shamans. Nastya is interested in whether there was at least one king-shaman in Byteland. Unfortunately many of the powers are unreadable in the list, so Nastya is doing the following: Initially she supposes some power for each shaman. After that she changes the power of some shaman q times (the shamans can differ) and after that wants to check if there is at least one king-shaman in the list. If yes, she wants to know the index of any king-shaman. Unfortunately the list is too large and Nastya wants you to help her. The first line contains two integers n and q ( 1 ≤ n , q ≤ 2·10 5 ). The second line contains n integers a 1 , ..., a n ( 0 ≤ a i ≤ 10 9 ), where a i is the magic power of the i -th shaman. After that q lines follow, the i -th of them contains two integers p i and x i ( 1 ≤ p i ≤ n , 0 ≤ x i ≤ 10 9 ) that mean that the new power of the p i -th shaman is x i . Print q lines, the i -th of them should contain - 1 , if after the i -th change there are no shaman-kings, and otherwise a single integer j , where j is an index of some king-shaman after the i -th change. If there are multiple king-shamans after each change, print the index of any of them. In the first example powers of shamans after the first change are equal to (2, 3) . The answer equals - 1 , because the sum of powers of shamans before the first shaman |
| 60083 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 42300807 | paulzrm | E | Aug. 31, 2018, 7:33 a.m. | OK | GNU C++ | TESTS | 95 | 342 | 10444800 | 2600 | |
| 39594116 | tolight | E | June 24, 2018, 7:44 a.m. | OK | GNU C++ | TESTS | 95 | 389 | 15257600 | 2600 | |
| 39607222 | tolight | E | June 24, 2018, 3:46 p.m. | OK | GNU C++ | TESTS | 95 | 405 | 8908800 | 2600 | |
| 41643886 | Even_Bao | E | Aug. 16, 2018, 7:26 a.m. | OK | GNU C++ | TESTS | 95 | 436 | 20889600 | 2600 | |
| 41643662 | Even_Bao | E | Aug. 16, 2018, 7:18 a.m. | OK | GNU C++ | TESTS | 95 | 436 | 20889600 | 2600 | |
| 39475989 | fleimgruber | E | June 21, 2018, 3:07 p.m. | OK | GNU C++ | TESTS | 95 | 451 | 8806400 | 2600 | |
| 41985734 | qiaozhanrong | E | Aug. 23, 2018, 5:57 a.m. | OK | GNU C++ | TESTS | 95 | 483 | 10854400 | 2600 | |
| 39412674 | rainy_season | E | June 19, 2018, 1:42 p.m. | OK | GNU C++ | TESTS | 94 | 530 | 10444800 | 2600 | |
| 39398477 | DataBaseManagementSystem | E | June 19, 2018, 4:53 a.m. | OK | GNU C++ | TESTS | 94 | 546 | 14438400 | 2600 | |
| 41469732 | fks20011206 | E | Aug. 11, 2018, 12:52 p.m. | OK | GNU C++ | TESTS | 95 | 546 | 15052800 | 2600 | |
| 47255538 | vjudge2 | E | Dec. 19, 2018, 10:16 a.m. | OK | GNU C++11 | TESTS | 95 | 218 | 17612800 | 2600 | |
| 47255494 | vjudge4 | E | Dec. 19, 2018, 10:15 a.m. | OK | GNU C++11 | TESTS | 95 | 234 | 17612800 | 2600 | |
| 47254751 | tlnllkbp | E | Dec. 19, 2018, 9:57 a.m. | OK | GNU C++11 | TESTS | 95 | 234 | 17612800 | 2600 | |
| 56057483 | iaNTU | E | June 26, 2019, 1:53 a.m. | OK | GNU C++11 | TESTS | 95 | 249 | 5529600 | 2600 | |
| 47808437 | dqa2020 | E | Jan. 1, 2019, 9:14 a.m. | OK | GNU C++11 | TESTS | 95 | 264 | 5427200 | 2600 | |
| 40931858 | ReaLNero1 | E | July 30, 2018, 1:23 a.m. | OK | GNU C++11 | TESTS | 95 | 280 | 17612800 | 2600 | |
| 39398156 | tokitsukaze | E | June 19, 2018, 4:36 a.m. | OK | GNU C++11 | TESTS | 94 | 280 | 17612800 | 2600 | |
| 39394596 | diogo | E | June 19, 2018, 12:24 a.m. | OK | GNU C++11 | TESTS | 94 | 296 | 8908800 | 2600 | |
| 40977191 | ReaLNero1 | E | July 30, 2018, 4:04 p.m. | OK | GNU C++11 | TESTS | 95 | 296 | 17612800 | 2600 | |
| 39465059 | pr3pony | E | June 21, 2018, 2:34 p.m. | OK | GNU C++11 | TESTS | 95 | 311 | 2457600 | 2600 | |
| 39604568 | WA_TLE | E | June 24, 2018, 1:55 p.m. | OK | GNU C++14 | TESTS | 95 | 296 | 8396800 | 2600 | |
| 39389124 | marcospaulo | E | June 18, 2018, 7:56 p.m. | OK | GNU C++14 | TESTS | 94 | 343 | 5632000 | 2600 | |
| 39394476 | Tiricabira | E | June 19, 2018, 12:09 a.m. | OK | GNU C++14 | TESTS | 94 | 343 | 6451200 | 2600 | |
| 40209250 | bibibi | E | July 11, 2018, 5:48 p.m. | OK | GNU C++14 | TESTS | 95 | 343 | 26419200 | 2600 | |
| 39394446 | Tiricabira | E | June 19, 2018, 12:05 a.m. | OK | GNU C++14 | TESTS | 94 | 358 | 6451200 | 2600 | |
| 57574981 | vjudge3 | E | July 23, 2019, 6:40 a.m. | OK | GNU C++14 | TESTS | 95 | 373 | 6246400 | 2600 | |
| 44326072 | lintoto | E | Oct. 14, 2018, 4:07 p.m. | OK | GNU C++14 | TESTS | 95 | 373 | 9011200 | 2600 | |
| 39862277 | Arya_ | E | July 2, 2018, 8:45 a.m. | OK | GNU C++14 | TESTS | 95 | 374 | 6758400 | 2600 | |
| 39392484 | kyleliu | E | June 18, 2018, 9:26 p.m. | OK | GNU C++14 | TESTS | 94 | 389 | 35328000 | 2600 | |
| 55701267 | vjudge3 | E | June 18, 2019, 4:24 a.m. | OK | GNU C++14 | TESTS | 95 | 404 | 13721600 | 2600 | |
| 69386697 | ivanilos | E | Jan. 22, 2020, 11:23 p.m. | OK | GNU C++17 | TESTS | 95 | 295 | 8806400 | 2600 | |
| 57573530 | vjudge2 | E | July 23, 2019, 6:12 a.m. | OK | GNU C++17 | TESTS | 95 | 312 | 20889600 | 2600 | |
| 49815930 | Silly_Bee | E | Feb. 12, 2019, 5:53 a.m. | OK | GNU C++17 | TESTS | 95 | 358 | 9011200 | 2600 | |
| 39395147 | 2014CAIS01 | E | June 19, 2018, 1:22 a.m. | OK | GNU C++17 | TESTS | 94 | 374 | 3686400 | 2600 | |
| 39412712 | Jakube | E | June 19, 2018, 1:43 p.m. | OK | GNU C++17 | TESTS | 94 | 374 | 7270400 | 2600 | |
| 43568158 | I_love_Y_UME | E | Sept. 29, 2018, 11:52 a.m. | OK | GNU C++17 | TESTS | 95 | 374 | 9011200 | 2600 | |
| 39670253 | CrafterKolyan | E | June 26, 2018, 8:43 a.m. | OK | GNU C++17 | TESTS | 95 | 374 | 9318400 | 2600 | |
| 39651928 | CrafterKolyan | E | June 25, 2018, 2:11 p.m. | OK | GNU C++17 | TESTS | 95 | 390 | 5632000 | 2600 | |
| 39404574 | _nthoang_ | E | June 19, 2018, 9:07 a.m. | OK | GNU C++17 | TESTS | 94 | 405 | 5632000 | 2600 | |
| 43567395 | I_love_Y_UME | E | Sept. 29, 2018, 11:35 a.m. | OK | GNU C++17 | TESTS | 95 | 405 | 9011200 | 2600 | |
| 39418784 | Ahmad | E | June 19, 2018, 5:56 p.m. | OK | Java 8 | TESTS | 94 | 530 | 0 | 2600 | |
| 49160360 | ZeyadKhattab | E | Jan. 29, 2019, 3:08 p.m. | OK | Java 8 | TESTS | 95 | 623 | 4710400 | 2600 | |
| 49158761 | ZeyadKhattab | E | Jan. 29, 2019, 2:38 p.m. | OK | Java 8 | TESTS | 95 | 639 | 4710400 | 2600 | |
| 49159126 | ZeyadKhattab | E | Jan. 29, 2019, 2:44 p.m. | OK | Java 8 | TESTS | 95 | 654 | 4710400 | 2600 | |
| 39422848 | kessido | E | June 19, 2018, 10:21 p.m. | OK | Java 8 | TESTS | 95 | 686 | 4915200 | 2600 | |
| 39394725 | kessido | E | June 19, 2018, 12:40 a.m. | OK | Java 8 | TESTS | 94 | 686 | 4915200 | 2600 | |
| 39418223 | Jeel_Vaishnav | E | June 19, 2018, 5:33 p.m. | OK | Java 8 | TESTS | 94 | 701 | 4505600 | 2600 | |
| 39422885 | kessido | E | June 19, 2018, 10:26 p.m. | OK | Java 8 | TESTS | 95 | 702 | 4915200 | 2600 | |
| 39420978 | tri | E | June 19, 2018, 7:52 p.m. | OK | Java 8 | TESTS | 95 | 779 | 5632000 | 2600 | |
| 46581393 | ZeyadKhattab | E | Dec. 4, 2018, 11:23 a.m. | OK | Java 8 | TESTS | 95 | 795 | 12697600 | 2600 | |
| 40659865 | vjudge2 | E | July 23, 2018, 6:34 a.m. | OK | MS C++ | TESTS | 95 | 577 | 20889600 | 2600 | |
| 39541807 | pericle | E | June 23, 2018, 12:48 p.m. | OK | MS C++ | TESTS | 95 | 1263 | 10854400 | 2600 | |
| 45901941 | vjudge5 | E | Nov. 18, 2018, 5:40 a.m. | OK | MS C++ | TESTS | 95 | 1699 | 3174400 | 2600 | |
| 45906104 | vjudge2 | E | Nov. 18, 2018, 8:29 a.m. | OK | MS C++ | TESTS | 95 | 2293 | 22425600 | 2600 | |
| 63369698 | AleksanderBalobanov | E | Oct. 25, 2019, 8:53 a.m. | OK | MS C++ 2017 | TESTS | 95 | 514 | 10035200 | 2600 | |
| 54149396 | pajenegod | E | May 14, 2019, 10:05 p.m. | OK | PyPy 2 | TESTS | 95 | 1949 | 49049600 | 2600 | |
| 54149442 | pajenegod | E | May 14, 2019, 10:07 p.m. | OK | PyPy 2 | TESTS | 95 | 2230 | 42188800 | 2600 | |
| 39387502 | pajenegod | E | June 18, 2018, 6:31 p.m. | OK | PyPy 2 | TESTS | 94 | 2604 | 42291200 | 2600 | |
| 39461868 | FalseMirror | E | June 21, 2018, 12:27 p.m. | OK | Rust | TESTS | 95 | 514 | 6246400 | 2600 | |
| 39458948 | cyand1317 | E | June 21, 2018, 10:39 a.m. | OK | Rust | TESTS | 95 | 1887 | 28876800 | 2600 |
Back to search problems