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 |
|---|---|---|---|---|---|---|
| 757 | Codecraft-17 and Codeforces Round 391 (Div. 1 + Div. 2, combined) | FINISHED | False | 10800 | 292170323 | Jan. 12, 2017, 3:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 646 ) | G | Can Bash Save the Day? | PROGRAMMING | data structures divide and conquer graphs trees | 2500 |
Whoa! You did a great job helping Team Rocket who managed to capture all the Pokemons sent by Bash. Meowth, part of Team Rocket, having already mastered the human language, now wants to become a master in programming as well. He agrees to free the Pokemons if Bash can answer his questions. Initially, Meowth gives Bash a weighted tree containing n nodes and a sequence a 1 , a 2 ..., a n which is a permutation of 1, 2, ..., n . Now, Mewoth makes q queries of one of the following forms: 1 l r v : meaning Bash should report , where dist ( a , b ) is the length of the shortest path from node a to node b in the given tree. 2 x : meaning Bash should swap a x and a x + 1 in the given sequence. This new sequence is used for later queries. Help Bash to answer the questions! The first line contains two integers n and q ( 1 ≤ n ≤ 2·10 5 , 1 ≤ q ≤ 2·10 5 ) — the number of nodes in the tree and the number of queries, respectively. The next line contains n space-separated integers — the sequence a 1 , a 2 , ..., a n which is a permutation of 1, 2, ..., n . Each of the next n - 1 lines contain three space-separated integers u , v , and w denoting that there exists an undirected edge between node u and node v of weight w , ( 1 ≤ u , v ≤ n , u ≠ v , 1 ≤ w ≤ 10 6 ). It is guaranteed that the given graph is a tree. Each query consists of two lines. First line contains single integer t , indicating the type of the query. Next line contains the description of the query: t = 1 : Second line contains three integers a , b and c ( 1 ≤ a , b , c < 2 30 ) using which l , r and v can be generated using the formula given below: , , . , , . t = 2 : Second line contains single integer a ( 1 ≤ a < 2 30 ) using which x can be generated using the formula given below: . . The ans i is the answer for the i -th query, assume that ans 0 = 0 . If the i -th query is of type 2 then ans i = ans i - 1 . It is guaranteed that: for each query of type 1 : 1 ≤ l ≤ r ≤ n , 1 ≤ v ≤ n , for each query of t |
| CodeCraft-17 and Codeforces Round #391 (Div. 1 + Div. 2, combined) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 40982696 | ReaLNero1 | G | July 30, 2018, 6:32 p.m. | OK | GNU C++ | TESTS | 151 | 1106 | 500736000 | 2500 | |
| 24915620 | orzer | G | Feb. 23, 2017, 12:14 p.m. | OK | GNU C++ | TESTS | 151 | 1170 | 502886400 | 2500 | |
| 24915038 | orzer | G | Feb. 23, 2017, 11:37 a.m. | OK | GNU C++ | TESTS | 151 | 1216 | 695500800 | 2500 | |
| 27795663 | MemS | G | June 15, 2017, 2:33 p.m. | OK | GNU C++ | TESTS | 151 | 1434 | 485376000 | 2500 | |
| 25147928 | ShinFeb | G | March 2, 2017, 12:43 p.m. | OK | GNU C++ | TESTS | 151 | 1638 | 498892800 | 2500 | |
| 24024519 | NagiNikaido | G | Jan. 22, 2017, 6:46 a.m. | OK | GNU C++ | TESTS | 151 | 1684 | 513843200 | 2500 | |
| 36084251 | Dream-Reality | G | March 9, 2018, 12:32 a.m. | OK | GNU C++ | TESTS | 151 | 1684 | 803737600 | 2500 | |
| 28503363 | Scut82 | G | July 13, 2017, 1:15 p.m. | OK | GNU C++ | TESTS | 151 | 1731 | 683417600 | 2500 | |
| 27817592 | xiqiao | G | June 16, 2017, 5:29 a.m. | OK | GNU C++ | TESTS | 151 | 1762 | 645120000 | 2500 | |
| 25499158 | Hermera | G | March 15, 2017, 1:20 p.m. | OK | GNU C++ | TESTS | 151 | 1762 | 675123200 | 2500 | |
| 53215182 | jazengm | G | April 24, 2019, 8:22 a.m. | OK | GNU C++11 | TESTS | 151 | 1216 | 481996800 | 2500 | |
| 53215925 | jazengm | G | April 24, 2019, 8:46 a.m. | OK | GNU C++11 | TESTS | 151 | 1325 | 313548800 | 2500 | |
| 53215457 | jazengm | G | April 24, 2019, 8:31 a.m. | OK | GNU C++11 | TESTS | 151 | 1325 | 385740800 | 2500 | |
| 51973870 | HolyK | G | March 29, 2019, 1:34 p.m. | OK | GNU C++11 | TESTS | 151 | 1419 | 644505600 | 2500 | |
| 47933155 | skywalkert | G | Jan. 4, 2019, 4:20 p.m. | OK | GNU C++11 | TESTS | 151 | 1419 | 770764800 | 2500 | |
| 25546985 | Talon_F | G | March 16, 2017, 11:45 a.m. | OK | GNU C++11 | TESTS | 151 | 1466 | 491212800 | 2500 | |
| 46357866 | Allunlimited | G | Nov. 29, 2018, 9:23 a.m. | OK | GNU C++11 | TESTS | 151 | 1466 | 581836800 | 2500 | |
| 53207153 | jazengm | G | April 23, 2019, 11:56 p.m. | OK | GNU C++11 | TESTS | 151 | 1559 | 481996800 | 2500 | |
| 36684257 | vjudge4 | G | March 28, 2018, 6:18 a.m. | OK | GNU C++11 | TESTS | 151 | 1591 | 684748800 | 2500 | |
| 53206879 | jazengm | G | April 23, 2019, 11:25 p.m. | OK | GNU C++11 | TESTS | 151 | 1622 | 481996800 | 2500 | |
| 55678774 | qiyue | G | June 17, 2019, 11:56 a.m. | OK | GNU C++14 | TESTS | 151 | 1200 | 497561600 | 2500 | |
| 58094844 | TadijaSebez | G | July 31, 2019, 7:13 p.m. | OK | GNU C++14 | TESTS | 151 | 1357 | 430182400 | 2500 | |
| 25500460 | Steven_Wu | G | March 15, 2017, 2:14 p.m. | OK | GNU C++14 | TESTS | 151 | 1622 | 683008000 | 2500 | |
| 36684313 | ykn1 | G | March 28, 2018, 6:21 a.m. | OK | GNU C++14 | TESTS | 151 | 1777 | 684748800 | 2500 | |
| 57616454 | Scut82 | G | July 24, 2019, 1:50 a.m. | OK | GNU C++14 | TESTS | 151 | 1903 | 506368000 | 2500 | |
| 64578784 | vjudge4 | G | Nov. 9, 2019, 11:29 a.m. | OK | GNU C++14 | TESTS | 151 | 1980 | 675532800 | 2500 | |
| 37872992 | lxlxl | G | May 4, 2018, 12:24 a.m. | OK | GNU C++14 | TESTS | 151 | 1981 | 756838400 | 2500 | |
| 26138766 | kiiiiii | G | April 5, 2017, 8:47 a.m. | OK | GNU C++14 | TESTS | 151 | 1996 | 688640000 | 2500 | |
| 57616276 | Scut82 | G | July 24, 2019, 1:44 a.m. | OK | GNU C++14 | TESTS | 151 | 2011 | 634675200 | 2500 | |
| 59346562 | Scut82 | G | Aug. 23, 2019, 9:56 a.m. | OK | GNU C++14 | TESTS | 151 | 2058 | 161587200 | 2500 | |
| 35954043 | xehoth | G | March 5, 2018, 1:33 a.m. | OK | GNU C++17 | TESTS | 151 | 1092 | 499916800 | 2500 | |
| 35953970 | xehoth | G | March 5, 2018, 1:26 a.m. | OK | GNU C++17 | TESTS | 151 | 1262 | 474009600 | 2500 | |
| 66879178 | vjudge4 | G | Dec. 14, 2019, 3:56 p.m. | OK | GNU C++17 | TESTS | 151 | 2011 | 155238400 | 2500 | |
| 51601126 | chinmay0906 | G | March 21, 2019, 3:56 a.m. | OK | GNU C++17 | TESTS | 151 | 3229 | 223232000 | 2500 | |
| 58535362 | sincerity | G | Aug. 10, 2019, 11:37 a.m. | OK | GNU C++17 | TESTS | 151 | 3931 | 250572800 | 2500 | |
| 58533857 | sincerity | G | Aug. 10, 2019, 10:53 a.m. | OK | GNU C++17 | TESTS | 151 | 4445 | 250572800 | 2500 | |
| 58532781 | sincerity | G | Aug. 10, 2019, 10:23 a.m. | OK | GNU C++17 | TESTS | 151 | 4586 | 265830400 | 2500 | |
| 52749762 | Rzepa | G | April 14, 2019, 1:27 p.m. | OK | GNU C++17 | TESTS | 151 | 4991 | 739840000 | 2500 | |
| 26245205 | Los_Angelos_Laycurse | G | April 9, 2017, 11:54 p.m. | OK | MS C++ | TESTS | 151 | 2386 | 145408000 | 2500 | |
| 69663264 | vjudge3 | G | Jan. 28, 2020, 10:18 a.m. | OK | MS C++ | TESTS | 151 | 3462 | 751820800 | 2500 | |
| 66810292 | vjudge2 | G | Dec. 14, 2019, 1:41 a.m. | OK | MS C++ | TESTS | 151 | 4399 | 224665600 | 2500 |
Back to search problems