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 |
---|---|---|---|---|---|---|
1677 | Codeforces Round 789 (Div. 1) | FINISHED | False | 7200 | 79802699 | May 8, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3633 ) | C | Tokitsukaze and Two Colorful Tapes | PROGRAMMING | constructive algorithms dfs and similar ds graphs greedy |
B'Tokitsukaze has two colorful tapes. There are n distinct colors, numbered 1 through n , and each color appears exactly once on each of the two tapes. Denote the color of the i -th position of the first tape as ca_i , and the color of the i -th position of the second tape as cb_i . Now Tokitsukaze wants to select each color an integer value from 1 to n , distinct for all the colors. After that she will put down the color values in each colored position on the tapes. Denote the number of the i -th position of the first tape as numa_i , and the number of the i -th position of the second tape as numb_i . For example, for the above picture, assuming that the color red has value x ( 1 <= q x <= q n ), it appears at the 1 -st position of the first tape and the 3 -rd position of the second tape, so numa_1=numb_3=x . Note that each color i from 1 to n should have a distinct value, and the same color which appears in both tapes has the same value. After labeling each color, the beauty of the two tapes is calculated as sum_{i=1}^{n}|numa_i-numb_i|. Please help Tokitsukaze to find the highest possible beauty. The first contains a single positive integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. For each test case, the first line contains a single integer n ( 1 <= q n <= q 10^5 ) -- the number of colors. The second line contains n integers ca_1, ca_2, ldots, ca_n ( 1 <= q ca_i <= q n ) -- the color of each position of the first tape. It is guaranteed that ca is a permutation. The third line contains n integers cb_1, cb_2, ldots, cb_n ( 1 <= q cb_i <= q n ) -- the color of each position of the second tape. It is guaranteed that cb is a permutation. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^{5} . For each test cas'... |
Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
156320821 | Gassa | C | May 8, 2022, 3:14 p.m. | OK | D | TESTS | 50 | 62 | 13516800 | ||
156314877 | hos.lyric | C | May 8, 2022, 3:02 p.m. | OK | D | TESTS | 50 | 78 | 13516800 | ||
156356508 | dean.menezes | C | May 8, 2022, 6:20 p.m. | OK | GNU C11 | TESTS | 50 | 93 | 2662400 | ||
156337404 | chro4896 | C | May 8, 2022, 3:59 p.m. | OK | GNU C11 | TESTS | 50 | 93 | 2764800 | ||
156375695 | CQYZWJH | C | May 9, 2022, 2:34 a.m. | OK | GNU C++14 | TESTS | 50 | 31 | 1228800 | ||
156376341 | wind_cross | C | May 9, 2022, 2:50 a.m. | OK | GNU C++14 | TESTS | 50 | 31 | 10137600 | ||
156377375 | Sol1 | C | May 9, 2022, 3:14 a.m. | OK | GNU C++14 | TESTS | 50 | 46 | 3686400 | ||
156340151 | Jonothor_Darry | C | May 8, 2022, 4:09 p.m. | OK | GNU C++14 | TESTS | 50 | 62 | 16998400 | ||
156334415 | SookeAKIOI | C | May 8, 2022, 3:50 p.m. | OK | GNU C++14 | TESTS | 50 | 77 | 3686400 | ||
156337691 | Aleph-zero | C | May 8, 2022, 4 p.m. | OK | GNU C++14 | TESTS | 50 | 77 | 32051200 | ||
156371273 | Suiseiseki | C | May 9, 2022, 12:41 a.m. | OK | GNU C++14 | TESTS | 50 | 78 | 921600 | ||
156327289 | shdut0901 | C | May 8, 2022, 3:30 p.m. | OK | GNU C++14 | TESTS | 50 | 78 | 1228800 | ||
156317150 | LZDQ | C | May 8, 2022, 3:06 p.m. | OK | GNU C++14 | TESTS | 50 | 78 | 1536000 | ||
156317534 | feecIe6418 | C | May 8, 2022, 3:07 p.m. | OK | GNU C++14 | TESTS | 50 | 78 | 1638400 | ||
156336264 | lddlinan | C | May 8, 2022, 3:56 p.m. | OK | GNU C++17 | TESTS | 50 | 62 | 1638400 | ||
156315141 | ZhouShang2003 | C | May 8, 2022, 3:02 p.m. | OK | GNU C++17 | TESTS | 50 | 62 | 1740800 | ||
156351151 | eggag32 | C | May 8, 2022, 5:24 p.m. | OK | GNU C++17 | TESTS | 50 | 62 | 4812800 | ||
156324026 | windy7926778 | C | May 8, 2022, 3:21 p.m. | OK | GNU C++17 | TESTS | 50 | 77 | 3379200 | ||
156347665 | Dremix10 | C | May 8, 2022, 4:32 p.m. | OK | GNU C++17 | TESTS | 50 | 78 | 2252800 | ||
156382761 | cs142857 | C | May 9, 2022, 5:20 a.m. | OK | GNU C++17 | TESTS | 50 | 78 | 2355200 | ||
156341037 | slah007 | C | May 8, 2022, 4:12 p.m. | OK | GNU C++17 | TESTS | 50 | 78 | 2764800 | ||
156368437 | DiegoGarcia | C | May 8, 2022, 10:48 p.m. | OK | GNU C++17 | TESTS | 50 | 78 | 3174400 | ||
156332081 | ace5 | C | May 8, 2022, 3:43 p.m. | OK | GNU C++17 | TESTS | 50 | 78 | 4198400 | ||
156311466 | ugly2333 | C | May 8, 2022, 2:56 p.m. | OK | GNU C++17 | TESTS | 50 | 78 | 4505600 | ||
156317718 | Juanzhang | C | May 8, 2022, 3:07 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 31 | 3993600 | ||
156309247 | QAQAutoMaton | C | May 8, 2022, 2:53 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 31 | 5836800 | ||
156327346 | LayCurse | C | May 8, 2022, 3:30 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 31 | 101171200 | ||
156302398 | ainta | C | May 8, 2022, 2:44 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 31 | 102297600 | ||
156379774 | snuphy | C | May 9, 2022, 4:12 a.m. | OK | GNU C++17 (64) | TESTS | 50 | 46 | 1331200 | ||
156330242 | huangxiaohua | C | May 8, 2022, 3:38 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 46 | 1638400 | ||
156353473 | minmise | C | May 8, 2022, 5:44 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 46 | 1740800 | ||
156345025 | hojoon0205 | C | May 8, 2022, 4:25 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 46 | 2150400 | ||
156325667 | cuom1999 | C | May 8, 2022, 3:25 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 46 | 2457600 | ||
156335660 | used-fft | C | May 8, 2022, 3:54 p.m. | OK | GNU C++17 (64) | TESTS | 50 | 46 | 2457600 | ||
156311932 | maspy | C | May 8, 2022, 2:57 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 15 | 2764800 | ||
156316252 | rsy | C | May 8, 2022, 3:05 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 15 | 2969600 | ||
156370710 | rsy | C | May 9, 2022, 12:20 a.m. | OK | GNU C++20 (64) | TESTS | 50 | 15 | 2969600 | ||
156356661 | ItayOtto | C | May 8, 2022, 6:22 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 31 | 1638400 | ||
156350929 | Linkus | C | May 8, 2022, 5:23 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 31 | 2355200 | ||
156320339 | liouzhou_101 | C | May 8, 2022, 3:13 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 31 | 5324800 | ||
156314322 | Elegia | C | May 8, 2022, 3:01 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 46 | 921600 | ||
156331132 | I_love_QMsh | C | May 8, 2022, 3:40 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 46 | 921600 | ||
156321632 | Icecream2001 | C | May 8, 2022, 3:16 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 46 | 1228800 | ||
156353316 | IsaacMoris | C | May 8, 2022, 5:42 p.m. | OK | GNU C++20 (64) | TESTS | 50 | 46 | 1228800 | ||
156331300 | knightL | C | May 8, 2022, 3:41 p.m. | OK | Java 11 | TESTS | 50 | 233 | 0 | ||
156342423 | yehara | C | May 8, 2022, 4:16 p.m. | OK | Java 11 | TESTS | 50 | 623 | 0 | ||
156366115 | fetetriste | C | May 8, 2022, 9:30 p.m. | OK | Java 8 | TESTS | 50 | 140 | 0 | ||
156342416 | megaspazz | C | May 8, 2022, 4:16 p.m. | OK | Java 8 | TESTS | 50 | 140 | 0 | ||
156341929 | DarLam | C | May 8, 2022, 4:15 p.m. | OK | Java 8 | TESTS | 50 | 155 | 0 | ||
156334492 | AndreySiunov | C | May 8, 2022, 3:50 p.m. | OK | Java 8 | TESTS | 50 | 171 | 0 | ||
156332546 | golions | C | May 8, 2022, 3:44 p.m. | OK | Java 8 | TESTS | 50 | 218 | 3993600 | ||
156331560 | SecondThread | C | May 8, 2022, 3:42 p.m. | OK | Java 8 | TESTS | 50 | 358 | 80076800 | ||
156333501 | DumplingLife | C | May 8, 2022, 3:47 p.m. | OK | Java 8 | TESTS | 50 | 405 | 31129600 | ||
156316502 | arvindf232 | C | May 8, 2022, 3:05 p.m. | OK | Kotlin 1.4 | TESTS | 50 | 140 | 0 | ||
156328620 | Hakiobo | C | May 8, 2022, 3:33 p.m. | OK | Kotlin 1.4 | TESTS | 50 | 171 | 0 | ||
156314373 | Tlatoani | C | May 8, 2022, 3:01 p.m. | OK | Kotlin 1.4 | TESTS | 50 | 327 | 8601600 | ||
156339689 | r57shell | C | May 8, 2022, 4:07 p.m. | OK | MS C++ 2017 | TESTS | 50 | 93 | 1433600 | ||
156328702 | machine_solution | C | May 8, 2022, 3:33 p.m. | OK | MS C++ 2017 | TESTS | 50 | 280 | 4608000 | ||
156355860 | NecroSean38 | C | May 8, 2022, 6:12 p.m. | OK | PyPy 3 | TESTS | 50 | 233 | 17510400 | ||
156320095 | whatshisbucket | C | May 8, 2022, 3:12 p.m. | OK | PyPy 3 | TESTS | 50 | 342 | 14131200 | ||
156338835 | titia | C | May 8, 2022, 4:04 p.m. | OK | PyPy 3-64 | TESTS | 50 | 218 | 28057600 | ||
156353347 | notTehlka | C | May 8, 2022, 5:43 p.m. | OK | PyPy 3-64 | TESTS | 50 | 249 | 26726400 | ||
156348374 | notnotTehlka | C | May 8, 2022, 4:34 p.m. | OK | PyPy 3-64 | TESTS | 50 | 249 | 26726400 | ||
156358252 | shobonvip | C | May 8, 2022, 6:47 p.m. | OK | PyPy 3-64 | TESTS | 50 | 327 | 27750400 | ||
156343701 | alex_mat | C | May 8, 2022, 4:21 p.m. | OK | PyPy 3-64 | TESTS | 50 | 374 | 22937600 | ||
156331936 | siganai | C | May 8, 2022, 3:43 p.m. | OK | PyPy 3-64 | TESTS | 50 | 374 | 28160000 | ||
156334608 | alexwice | C | May 8, 2022, 3:51 p.m. | OK | PyPy 3-64 | TESTS | 50 | 374 | 32153600 | ||
156346602 | coconut99 | C | May 8, 2022, 4:29 p.m. | OK | PyPy 3-64 | TESTS | 50 | 436 | 22118400 | ||
156315710 | asdsasd | C | May 8, 2022, 3:04 p.m. | OK | PyPy 3-64 | TESTS | 50 | 483 | 23552000 | ||
156341892 | ishsonya | C | May 8, 2022, 4:14 p.m. | OK | PyPy 3-64 | TESTS | 50 | 670 | 27443200 | ||
156346328 | Jimanbanashi | C | May 8, 2022, 4:28 p.m. | OK | Python 2 | TESTS | 50 | 280 | 8192000 | ||
156338697 | taiga0629 | C | May 8, 2022, 4:04 p.m. | OK | Python 3 | TESTS | 50 | 701 | 9932800 | ||
156377562 | Spheniscine | C | May 9, 2022, 3:19 a.m. | OK | Rust 2021 | TESTS | 50 | 31 | 3788800 | ||
156315760 | sansen | C | May 8, 2022, 3:04 p.m. | OK | Rust 2021 | TESTS | 50 | 31 | 7372800 | ||
156377474 | Spheniscine | C | May 9, 2022, 3:17 a.m. | OK | Rust 2021 | TESTS | 50 | 46 | 3788800 | ||
156318840 | qwerty787788 | C | May 8, 2022, 3:10 p.m. | OK | Rust 2021 | TESTS | 50 | 46 | 4608000 | ||
156331189 | Spheniscine | C | May 8, 2022, 3:41 p.m. | OK | Rust 2021 | TESTS | 50 | 46 | 5427200 | ||
156361021 | clause | C | May 8, 2022, 7:32 p.m. | OK | Rust 2021 | TESTS | 50 | 186 | 5120000 |
Back to search problems