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 |
---|---|---|---|---|---|---|
1789 | Codeforces Round 853 (Div. 2) | FINISHED | False | 7200 | 54488399 | Feb. 25, 2023, 2:20 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 8652 ) | C | Serval and Toxel's Arrays | PROGRAMMING | combinatorics implementation math |
B'Toxel likes arrays. Before traveling to the Paldea region, Serval gave him an array a as a gift. This array has n pairwise distinct elements. In order to get more arrays, Toxel performed m operations with the initial array. In the i -th operation, he modified the p_{i} -th element of the (i-1) -th array to v_{i} , resulting in the i -th array (the initial array a is numbered as 0 ). During modifications, Toxel guaranteed that the elements of each array are still pairwise distinct after each operation. Finally, Toxel got m+1 arrays and denoted them as A_{0}=a, A_{1}, ldots,A_{m} . For each pair (i,j) ( 0 <= i<j <= m ), Toxel defines its value as the number of distinct elements of the concatenation of A_{i} and A_{j} . Now Toxel wonders, what is the sum of the values of all pairs? Please help him to calculate the answer. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^{4} ). The description of the test cases follows. The first line of each test case contains two integers n and m ( 1 <= n,m <= 2 cdot10^{5} ) -- the length of the array and the number of operations. The second line of each test case contains n integers a_{1},a_{2}, ... ,a_{n} ( 1 <= a_{i} <= n+m ). It is guaranteed that all a_i are pairwise distinct. Each of the next m lines of each test case contains two integers p_{i} and v_{i} ( 1 <= p_{i} <= n , 1 <= v_{i} <= n+m ) -- the position of the modified element and its new value. It is guaranteed that the elements of each array are still pairwise distinct after each modification. It is guaranteed that the sum of n and the sum of m over all test cases do not exceed 2 cdot10^{5} . For each test case, print a single integer -- the sum of the values of all pairs of arrays. In the first test case, the arrays change as f'... |
Codeforces Round #853 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
194994440 | presumption | C | Feb. 25, 2023, 8:53 p.m. | OK | GNU C11 | TESTS | 39 | 140 | 3993600 | ||
194999938 | ama_ada | C | Feb. 25, 2023, 10:33 p.m. | OK | GNU C11 | TESTS | 39 | 140 | 16076800 | ||
194962788 | edwardnvv57k | C | Feb. 25, 2023, 3:50 p.m. | OK | GNU C11 | TESTS | 39 | 171 | 11161600 | ||
194958952 | lingyc | C | Feb. 25, 2023, 3:36 p.m. | OK | GNU C++14 | TESTS | 39 | 109 | 6451200 | ||
195010722 | lizsen | C | Feb. 26, 2023, 3:45 a.m. | OK | GNU C++14 | TESTS | 39 | 124 | 4812800 | ||
195004735 | chenye3 | C | Feb. 26, 2023, 1:05 a.m. | OK | GNU C++14 | TESTS | 39 | 139 | 8806400 | ||
195006423 | Yuki991 | C | Feb. 26, 2023, 1:53 a.m. | OK | GNU C++14 | TESTS | 39 | 140 | 2457600 | ||
194978222 | MrLinYin | C | Feb. 25, 2023, 5:32 p.m. | OK | GNU C++14 | TESTS | 39 | 140 | 3174400 | ||
195015648 | ONLOX | C | Feb. 26, 2023, 5:26 a.m. | OK | GNU C++14 | TESTS | 39 | 140 | 3993600 | ||
194956555 | beckham_of_laiwu | C | Feb. 25, 2023, 3:29 p.m. | OK | GNU C++14 | TESTS | 39 | 140 | 4812800 | ||
194967872 | h0494 | C | Feb. 25, 2023, 4:09 p.m. | OK | GNU C++14 | TESTS | 39 | 140 | 6553600 | ||
195006297 | ztlh | C | Feb. 26, 2023, 1:50 a.m. | OK | GNU C++14 | TESTS | 39 | 140 | 7168000 | ||
195015665 | Xanadu13 | C | Feb. 26, 2023, 5:27 a.m. | OK | GNU C++14 | TESTS | 39 | 155 | 3993600 | ||
194996715 | snacache | C | Feb. 25, 2023, 9:30 p.m. | OK | GNU C++17 | TESTS | 39 | 109 | 3993600 | ||
194976747 | walk_alone | C | Feb. 25, 2023, 5:19 p.m. | OK | GNU C++17 | TESTS | 39 | 124 | 3993600 | ||
194993187 | DaviHenrique | C | Feb. 25, 2023, 8:30 p.m. | OK | GNU C++17 | TESTS | 39 | 139 | 3993600 | ||
194964972 | M-o-b-a-r-a-k | C | Feb. 25, 2023, 3:58 p.m. | OK | GNU C++17 | TESTS | 39 | 139 | 14028800 | ||
194968436 | WhiteCrow | C | Feb. 25, 2023, 4:11 p.m. | OK | GNU C++17 | TESTS | 39 | 140 | 3993600 | ||
194958991 | Kelin | C | Feb. 25, 2023, 3:36 p.m. | OK | GNU C++17 | TESTS | 39 | 140 | 3993600 | ||
195010482 | Yuryyy | C | Feb. 26, 2023, 3:39 a.m. | OK | GNU C++17 | TESTS | 39 | 140 | 4812800 | ||
194964754 | ConquerorOfMyself | C | Feb. 25, 2023, 3:57 p.m. | OK | GNU C++17 | TESTS | 39 | 140 | 6451200 | ||
194956768 | 0734919 | C | Feb. 25, 2023, 3:30 p.m. | OK | GNU C++17 | TESTS | 39 | 155 | 2457600 | ||
195013743 | TaylorFly | C | Feb. 26, 2023, 4:55 a.m. | OK | GNU C++17 | TESTS | 39 | 155 | 3174400 | ||
194969414 | ItsRashi | C | Feb. 25, 2023, 4:15 p.m. | OK | GNU C++17 (64) | TESTS | 39 | 93 | 2457600 | ||
194998767 | enslaved | C | Feb. 25, 2023, 10:07 p.m. | OK | GNU C++17 (64) | TESTS | 39 | 93 | 6451200 | ||
194992557 | lemongrab | C | Feb. 25, 2023, 8:20 p.m. | OK | GNU C++17 (64) | TESTS | 39 | 93 | 9625600 | ||
194964022 | southward | C | Feb. 25, 2023, 3:54 p.m. | OK | GNU C++17 (64) | TESTS | 39 | 93 | 16384000 | ||
195003226 | PurpleCrayon | C | Feb. 26, 2023, 12:09 a.m. | OK | GNU C++17 (64) | TESTS | 39 | 108 | 3993600 | ||
194992607 | Mhamad_aboaljood | C | Feb. 25, 2023, 8:21 p.m. | OK | GNU C++17 (64) | TESTS | 39 | 108 | 4812800 | ||
194962747 | Edu175 | C | Feb. 25, 2023, 3:50 p.m. | OK | GNU C++17 (64) | TESTS | 39 | 108 | 7987200 | ||
194957095 | Z-wzy | C | Feb. 25, 2023, 3:31 p.m. | OK | GNU C++17 (64) | TESTS | 39 | 108 | 96153600 | ||
195012697 | BuptNorthRemembers | C | Feb. 26, 2023, 4:34 a.m. | OK | GNU C++17 (64) | TESTS | 39 | 109 | 2457600 | ||
194976447 | AmirAli-Asgari | C | Feb. 25, 2023, 5:17 p.m. | OK | GNU C++17 (64) | TESTS | 39 | 109 | 5222400 | ||
195015317 | bxhnb | C | Feb. 26, 2023, 5:21 a.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 2764800 | ||
195011749 | AbdalrhmanEssam | C | Feb. 26, 2023, 4:11 a.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 3993600 | ||
194985520 | yllo | C | Feb. 25, 2023, 6:45 p.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 3993600 | ||
194997329 | robux_scam | C | Feb. 25, 2023, 9:41 p.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 3993600 | ||
194964652 | Itsaditi | C | Feb. 25, 2023, 3:57 p.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 4812800 | ||
195005312 | CTB220406 | C | Feb. 26, 2023, 1:22 a.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 4812800 | ||
195004606 | A__S | C | Feb. 26, 2023, 1 a.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 4812800 | ||
194993161 | mcuadros | C | Feb. 25, 2023, 8:30 p.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 4812800 | ||
194980289 | yyhs_fan | C | Feb. 25, 2023, 5:52 p.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 6451200 | ||
195013023 | uchicha_itachi | C | Feb. 26, 2023, 4:41 a.m. | OK | GNU C++20 (64) | TESTS | 39 | 78 | 7987200 | ||
194978392 | ETHANHUNTMI5 | C | Feb. 25, 2023, 5:33 p.m. | OK | Java 11 | TESTS | 39 | 311 | 4198400 | ||
194956493 | dzhi | C | Feb. 25, 2023, 3:29 p.m. | OK | Java 11 | TESTS | 39 | 327 | 5017600 | ||
194966436 | NewbiePupil | C | Feb. 25, 2023, 4:03 p.m. | OK | Java 11 | TESTS | 39 | 342 | 0 | ||
194966540 | kasiru_69 | C | Feb. 25, 2023, 4:04 p.m. | OK | Java 11 | TESTS | 39 | 342 | 1331200 | ||
194992099 | sad_truant | C | Feb. 25, 2023, 8:13 p.m. | OK | Java 11 | TESTS | 39 | 373 | 7987200 | ||
194963295 | Prime369 | C | Feb. 25, 2023, 3:51 p.m. | OK | Java 11 | TESTS | 39 | 405 | 10342400 | ||
194959762 | Oz121 | C | Feb. 25, 2023, 3:39 p.m. | OK | Java 11 | TESTS | 39 | 452 | 20889600 | ||
194957303 | kamranm | C | Feb. 25, 2023, 3:32 p.m. | OK | Java 11 | TESTS | 39 | 514 | 209510400 | ||
194970408 | sunnykumar2708 | C | Feb. 25, 2023, 4:18 p.m. | OK | Java 11 | TESTS | 39 | 701 | 51814400 | ||
194970508 | Coew | C | Feb. 25, 2023, 4:18 p.m. | OK | Java 11 | TESTS | 39 | 716 | 51814400 | ||
194965083 | medeepak0_0 | C | Feb. 25, 2023, 3:58 p.m. | OK | Java 17 | TESTS | 39 | 233 | 614400 | ||
194964897 | bleach__ | C | Feb. 25, 2023, 3:58 p.m. | OK | Java 17 | TESTS | 39 | 343 | 17203200 | ||
194960899 | Restricted | C | Feb. 25, 2023, 3:43 p.m. | OK | Java 17 | TESTS | 39 | 623 | 24780800 | ||
194968373 | sr.yosefayman | C | Feb. 25, 2023, 4:11 p.m. | OK | Java 17 | TESTS | 39 | 795 | 58265600 | ||
194969775 | ayushcoding100 | C | Feb. 25, 2023, 4:16 p.m. | OK | Java 17 | TESTS | 39 | 811 | 59289600 | ||
194967828 | xyz41803 | C | Feb. 25, 2023, 4:09 p.m. | OK | Java 17 | TESTS | 39 | 811 | 60211200 | ||
194968972 | ahmedmostafa1778 | C | Feb. 25, 2023, 4:14 p.m. | OK | Java 17 | TESTS | 39 | 857 | 59801600 | ||
194965735 | Godlina | C | Feb. 25, 2023, 4:01 p.m. | OK | Java 17 | TESTS | 39 | 873 | 59801600 | ||
194968480 | dheeraj.rao | C | Feb. 25, 2023, 4:12 p.m. | OK | Java 17 | TESTS | 39 | 888 | 60108800 | ||
194965737 | Bikash0258 | C | Feb. 25, 2023, 4:01 p.m. | OK | Java 17 | TESTS | 39 | 904 | 59084800 | ||
194962555 | GR1ZLER | C | Feb. 25, 2023, 3:49 p.m. | OK | Java 8 | TESTS | 39 | 139 | 0 | ||
195013425 | priyaroy3370 | C | Feb. 26, 2023, 4:49 a.m. | OK | Java 8 | TESTS | 39 | 202 | 2969600 | ||
194968552 | dogranmol | C | Feb. 25, 2023, 4:12 p.m. | OK | Java 8 | TESTS | 39 | 233 | 3481600 | ||
194989452 | Deependra_coder | C | Feb. 25, 2023, 7:36 p.m. | OK | Java 8 | TESTS | 39 | 233 | 5939200 | ||
194959714 | ljaewon97 | C | Feb. 25, 2023, 3:39 p.m. | OK | Java 8 | TESTS | 39 | 233 | 5939200 | ||
194968802 | Akshit1515 | C | Feb. 25, 2023, 4:13 p.m. | OK | Java 8 | TESTS | 39 | 234 | 2764800 | ||
195013211 | Java_Programmer | C | Feb. 26, 2023, 4:44 a.m. | OK | Java 8 | TESTS | 39 | 249 | 6451200 | ||
194973682 | invincible777 | C | Feb. 25, 2023, 4:59 p.m. | OK | Java 8 | TESTS | 39 | 249 | 11468800 | ||
194957112 | megaspazz | C | Feb. 25, 2023, 3:31 p.m. | OK | Java 8 | TESTS | 39 | 389 | 72601600 | ||
194965845 | Virendra115 | C | Feb. 25, 2023, 4:01 p.m. | OK | Java 8 | TESTS | 39 | 421 | 11571200 | ||
194993814 | yllo | C | Feb. 25, 2023, 8:41 p.m. | OK | Kotlin 1.6 | TESTS | 39 | 717 | 23347200 | ||
194999441 | hotkey | C | Feb. 25, 2023, 10:22 p.m. | OK | Kotlin 1.7 | TESTS | 39 | 748 | 120422400 | ||
194993715 | yllo | C | Feb. 25, 2023, 8:39 p.m. | OK | Kotlin 1.7 | TESTS | 39 | 1528 | 159641600 | ||
194974218 | Shkiper | C | Feb. 25, 2023, 5:03 p.m. | OK | MS C++ 2017 | TESTS | 39 | 452 | 3174400 | ||
194959770 | Tor_250 | C | Feb. 25, 2023, 3:39 p.m. | OK | MS C++ 2017 | TESTS | 39 | 561 | 6451200 | ||
194975121 | aadrito | C | Feb. 25, 2023, 5:08 p.m. | OK | MS C++ 2017 | TESTS | 39 | 577 | 15564800 | ||
194958896 | maxK99 | C | Feb. 25, 2023, 3:36 p.m. | OK | MS C++ 2017 | TESTS | 39 | 733 | 34918400 | ||
194965614 | Ahmedmadbouly186 | C | Feb. 25, 2023, 4 p.m. | OK | MS C++ 2017 | TESTS | 39 | 1326 | 33792000 | ||
194957990 | gaspar.kristijan | C | Feb. 25, 2023, 3:34 p.m. | OK | MS C++ 2017 | TESTS | 39 | 1824 | 46899200 | ||
195010774 | Defender_of_Argus | C | Feb. 26, 2023, 3:47 a.m. | OK | Node.js | TESTS | 39 | 685 | 71680000 | ||
195010496 | Defender_of_Argus | C | Feb. 26, 2023, 3:39 a.m. | OK | Node.js | TESTS | 39 | 936 | 114278400 | ||
194975309 | fme | C | Feb. 25, 2023, 5:09 p.m. | OK | PyPy 2 | TESTS | 39 | 1637 | 43008000 | ||
194964374 | JohnX4321 | C | Feb. 25, 2023, 3:56 p.m. | OK | PyPy 3 | TESTS | 39 | 296 | 24576000 | ||
194959573 | Mukundan314 | C | Feb. 25, 2023, 3:38 p.m. | OK | PyPy 3 | TESTS | 39 | 498 | 27136000 | ||
194956831 | KeiTsukishima | C | Feb. 25, 2023, 3:30 p.m. | OK | PyPy 3 | TESTS | 39 | 608 | 32051200 | ||
194964826 | rajbunsha | C | Feb. 25, 2023, 3:57 p.m. | OK | PyPy 3 | TESTS | 39 | 670 | 15667200 | ||
195011298 | broshen | C | Feb. 26, 2023, 3:59 a.m. | OK | PyPy 3 | TESTS | 39 | 1887 | 25395200 | ||
194998790 | kavorka | C | Feb. 25, 2023, 10:07 p.m. | OK | PyPy 3-64 | TESTS | 39 | 202 | 27340800 | ||
194981314 | hvbird | C | Feb. 25, 2023, 6:01 p.m. | OK | PyPy 3-64 | TESTS | 39 | 217 | 26931200 | ||
194976582 | zouyu9631 | C | Feb. 25, 2023, 5:18 p.m. | OK | PyPy 3-64 | TESTS | 39 | 217 | 29798400 | ||
194998819 | kavorka | C | Feb. 25, 2023, 10:08 p.m. | OK | PyPy 3-64 | TESTS | 39 | 218 | 21094400 | ||
195003220 | liuaaa | C | Feb. 26, 2023, 12:09 a.m. | OK | PyPy 3-64 | TESTS | 39 | 218 | 22732800 | ||
194998751 | kavorka | C | Feb. 25, 2023, 10:06 p.m. | OK | PyPy 3-64 | TESTS | 39 | 218 | 27340800 | ||
194977877 | abcsumits | C | Feb. 25, 2023, 5:29 p.m. | OK | PyPy 3-64 | TESTS | 39 | 233 | 23142400 | ||
194993135 | Remineva | C | Feb. 25, 2023, 8:29 p.m. | OK | PyPy 3-64 | TESTS | 39 | 233 | 25395200 | ||
194999054 | SugoiTurtle | C | Feb. 25, 2023, 10:14 p.m. | OK | PyPy 3-64 | TESTS | 39 | 233 | 27238400 | ||
194998773 | kavorka | C | Feb. 25, 2023, 10:07 p.m. | OK | PyPy 3-64 | TESTS | 39 | 233 | 27238400 | ||
194969564 | medveeedik | C | Feb. 25, 2023, 4:16 p.m. | OK | Python 3 | TESTS | 39 | 795 | 17510400 | ||
195007218 | fathorse | C | Feb. 26, 2023, 2:14 a.m. | OK | Python 3 | TESTS | 39 | 920 | 40345600 | ||
194970073 | A_Ankit | C | Feb. 25, 2023, 4:17 p.m. | OK | Python 3 | TESTS | 39 | 936 | 14643200 | ||
194986716 | Great_Druk | C | Feb. 25, 2023, 7 p.m. | OK | Python 3 | TESTS | 39 | 951 | 15462400 | ||
194969470 | python_098 | C | Feb. 25, 2023, 4:15 p.m. | OK | Python 3 | TESTS | 39 | 967 | 15462400 | ||
194987422 | Ratery | C | Feb. 25, 2023, 7:09 p.m. | OK | Python 3 | TESTS | 39 | 982 | 38604800 | ||
194967132 | coderSuren | C | Feb. 25, 2023, 4:06 p.m. | OK | Python 3 | TESTS | 39 | 1013 | 45875200 | ||
194959543 | khom | C | Feb. 25, 2023, 3:38 p.m. | OK | Python 3 | TESTS | 39 | 1029 | 51097600 | ||
194969931 | hussain109164 | C | Feb. 25, 2023, 4:17 p.m. | OK | Python 3 | TESTS | 39 | 1154 | 33280000 | ||
194974072 | ALSTON16 | C | Feb. 25, 2023, 5:02 p.m. | OK | Python 3 | TESTS | 39 | 1262 | 58777600 | ||
194982285 | God_Man | C | Feb. 25, 2023, 6:11 p.m. | OK | Rust 2021 | TESTS | 39 | 46 | 12185600 | ||
194981669 | God_Man | C | Feb. 25, 2023, 6:05 p.m. | OK | Rust 2021 | TESTS | 39 | 46 | 12185600 | ||
194978841 | God_Man | C | Feb. 25, 2023, 5:38 p.m. | OK | Rust 2021 | TESTS | 39 | 61 | 11161600 | ||
194978612 | God_Man | C | Feb. 25, 2023, 5:35 p.m. | OK | Rust 2021 | TESTS | 39 | 93 | 19148800 | ||
194975837 | God_Man | C | Feb. 25, 2023, 5:12 p.m. | OK | Rust 2021 | TESTS | 39 | 93 | 19148800 | ||
194959950 | sakikuroe | C | Feb. 25, 2023, 3:40 p.m. | OK | Rust 2021 | TESTS | 39 | 124 | 12185600 | ||
194963555 | liut | C | Feb. 25, 2023, 3:52 p.m. | OK | Rust 2021 | TESTS | 39 | 171 | 54067200 |
Back to search problems