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 |
---|---|---|---|---|---|---|
1898 | Codeforces Round 910 (Div. 2) | FINISHED | False | 7200 | 31418699 | Nov. 19, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 5319 ) | D | Absolute Beauty | PROGRAMMING | greedy math |
B'Kirill has two integer arrays a_1,a_2, ldots,a_n and b_1,b_2, ldots,b_n of length n . He defines the absolute beauty of the array b as sum_{i=1}^{n} |a_i - b_i|. Here, |x| denotes the absolute value of x . Kirill can perform the following operation at most once: Help him find the maximum possible absolute beauty of the array b after performing at most one swap. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= q t <= q 10 ,000 ). The description of test cases follows. The first line of each test case contains a single integer n ( 2 <= q n <= q 2 cdot 10^5 ) -- the length of the arrays a and b . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ) -- the array a . The third line of each test case contains n integers b_1, b_2, ldots, b_n ( 1 <= q b_i <= q 10^9 ) -- the array b . It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output one integer -- the maximum possible absolute beauty of the array b after no more than one swap. In the first test case, each of the possible swaps does not change the array b . In the second test case, the absolute beauty of the array b without performing the swap is |1-1| + |2-2| = 0 . After swapping the first and the second element in the array b , the absolute beauty becomes |1-2| + |2-1| = 2 . These are all the possible outcomes, hence the answer is 2 . In the third test case, it is optimal for Kirill to not perform the swap. Similarly to the previous test case, the answer is 2 . In the fourth test case, no matter what Kirill does, the absolute beauty of b remains equal to 16 . '... |
Editorial for Codeforces Round #910 (Div. 2) |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
233501402 | Derato | D | Nov. 19, 2023, 9:48 p.m. | OK | C# 10 | TESTS | 36 | 108 | 13619200 | ||
233485892 | ruban | D | Nov. 19, 2023, 6:22 p.m. | OK | FPC | TESTS | 36 | 171 | 93081600 | ||
233509209 | Phoniex_Tail | D | Nov. 20, 2023, 1:40 a.m. | OK | GNU C11 | TESTS | 36 | 124 | 819200 | ||
233488535 | Yzm007 | D | Nov. 19, 2023, 6:50 p.m. | OK | GNU C++14 | TESTS | 36 | 109 | 1638400 | ||
233488919 | Yzm007 | D | Nov. 19, 2023, 6:54 p.m. | OK | GNU C++14 | TESTS | 36 | 109 | 6451200 | ||
233506423 | ccsu_zx | D | Nov. 20, 2023, 12:09 a.m. | OK | GNU C++14 | TESTS | 36 | 124 | 1638400 | ||
233479122 | TrendBattles | D | Nov. 19, 2023, 5:17 p.m. | OK | GNU C++14 | TESTS | 36 | 124 | 1638400 | ||
233470372 | Comentropy | D | Nov. 19, 2023, 4:25 p.m. | OK | GNU C++14 | TESTS | 36 | 124 | 1638400 | ||
233467874 | Yzm007 | D | Nov. 19, 2023, 4:17 p.m. | OK | GNU C++14 | TESTS | 36 | 124 | 1638400 | ||
233514698 | Binp | D | Nov. 20, 2023, 3:46 a.m. | OK | GNU C++14 | TESTS | 36 | 124 | 1638400 | ||
233517843 | ollo | D | Nov. 20, 2023, 4:51 a.m. | OK | GNU C++14 | TESTS | 36 | 124 | 3174400 | ||
233467009 | mal1050 | D | Nov. 19, 2023, 4:14 p.m. | OK | GNU C++14 | TESTS | 36 | 124 | 16076800 | ||
233469344 | cocohearts | D | Nov. 19, 2023, 4:22 p.m. | OK | GNU C++14 | TESTS | 36 | 139 | 1638400 | ||
233509418 | superk961106 | D | Nov. 20, 2023, 1:46 a.m. | OK | GNU C++17 | TESTS | 36 | 109 | 819200 | ||
233508993 | TJLG-fly | D | Nov. 20, 2023, 1:34 a.m. | OK | GNU C++17 | TESTS | 36 | 109 | 1638400 | ||
233463011 | Enchom | D | Nov. 19, 2023, 4:02 p.m. | OK | GNU C++17 | TESTS | 36 | 109 | 2457600 | ||
233472630 | luoZH111 | D | Nov. 19, 2023, 4:31 p.m. | OK | GNU C++17 | TESTS | 36 | 124 | 819200 | ||
233513763 | sjm150 | D | Nov. 20, 2023, 3:27 a.m. | OK | GNU C++17 | TESTS | 36 | 124 | 819200 | ||
233485235 | verywater | D | Nov. 19, 2023, 6:16 p.m. | OK | GNU C++17 | TESTS | 36 | 124 | 1536000 | ||
233517302 | LiuYiWen | D | Nov. 20, 2023, 4:41 a.m. | OK | GNU C++17 | TESTS | 36 | 124 | 1638400 | ||
233514918 | Shaw_Wesley | D | Nov. 20, 2023, 3:50 a.m. | OK | GNU C++17 | TESTS | 36 | 124 | 1638400 | ||
233514154 | Muelsyse_ | D | Nov. 20, 2023, 3:35 a.m. | OK | GNU C++17 | TESTS | 36 | 124 | 1638400 | ||
233518361 | practice_has | D | Nov. 20, 2023, 4:59 a.m. | OK | GNU C++17 | TESTS | 36 | 124 | 1638400 | ||
233493839 | camc | D | Nov. 19, 2023, 7:53 p.m. | OK | GNU C++17 (64) | TESTS | 36 | 78 | 1638400 | ||
233464242 | FloatingOcean | D | Nov. 19, 2023, 4:06 p.m. | OK | GNU C++17 (64) | TESTS | 36 | 78 | 3174400 | ||
233486863 | MrPerson | D | Nov. 19, 2023, 6:32 p.m. | OK | GNU C++17 (64) | TESTS | 36 | 78 | 3174400 | ||
233512347 | zwh_zzz | D | Nov. 20, 2023, 2:59 a.m. | OK | GNU C++17 (64) | TESTS | 36 | 78 | 6451200 | ||
233506077 | Pointy | D | Nov. 19, 2023, 11:56 p.m. | OK | GNU C++17 (64) | TESTS | 36 | 78 | 24064000 | ||
233515096 | _2__0 | D | Nov. 20, 2023, 3:54 a.m. | OK | GNU C++17 (64) | TESTS | 36 | 92 | 3174400 | ||
233514062 | DinosaurSlayer | D | Nov. 20, 2023, 3:34 a.m. | OK | GNU C++17 (64) | TESTS | 36 | 93 | 1638400 | ||
233513240 | wsyear | D | Nov. 20, 2023, 3:17 a.m. | OK | GNU C++17 (64) | TESTS | 36 | 93 | 1638400 | ||
233518556 | niqiqi | D | Nov. 20, 2023, 5:03 a.m. | OK | GNU C++17 (64) | TESTS | 36 | 93 | 1638400 | ||
233511843 | roundspecs | D | Nov. 20, 2023, 2:47 a.m. | OK | GNU C++17 (64) | TESTS | 36 | 93 | 1638400 | ||
233475987 | kyon2326 | D | Nov. 19, 2023, 4:55 p.m. | OK | GNU C++20 (64) | TESTS | 36 | 31 | 3481600 | ||
233463385 | xu826281112 | D | Nov. 19, 2023, 4:03 p.m. | OK | GNU C++20 (64) | TESTS | 36 | 46 | 5734400 | ||
233477949 | Folka | D | Nov. 19, 2023, 5:08 p.m. | OK | GNU C++20 (64) | TESTS | 36 | 62 | 819200 | ||
233485134 | pavel..pers | D | Nov. 19, 2023, 6:15 p.m. | OK | GNU C++20 (64) | TESTS | 36 | 62 | 819200 | ||
233479376 | sputn1k | D | Nov. 19, 2023, 5:19 p.m. | OK | GNU C++20 (64) | TESTS | 36 | 62 | 819200 | ||
233479161 | sputn1k | D | Nov. 19, 2023, 5:17 p.m. | OK | GNU C++20 (64) | TESTS | 36 | 62 | 819200 | ||
233478939 | sputn1k | D | Nov. 19, 2023, 5:15 p.m. | OK | GNU C++20 (64) | TESTS | 36 | 62 | 819200 | ||
233513277 | lxy_sheep | D | Nov. 20, 2023, 3:18 a.m. | OK | GNU C++20 (64) | TESTS | 36 | 62 | 1638400 | ||
233513265 | manjuan01 | D | Nov. 20, 2023, 3:18 a.m. | OK | GNU C++20 (64) | TESTS | 36 | 62 | 1638400 | ||
233516091 | shengshu | D | Nov. 20, 2023, 4:17 a.m. | OK | GNU C++20 (64) | TESTS | 36 | 62 | 1638400 | ||
233467635 | Ramez__ | D | Nov. 19, 2023, 4:16 p.m. | OK | Java 11 | TESTS | 36 | 327 | 9216000 | ||
233482802 | kasiru_69 | D | Nov. 19, 2023, 5:51 p.m. | OK | Java 11 | TESTS | 36 | 358 | 8192000 | ||
233464183 | GR1ZLER | D | Nov. 19, 2023, 4:06 p.m. | OK | Java 11 | TESTS | 36 | 420 | 6758400 | ||
233461631 | man-ray | D | Nov. 19, 2023, 3:57 p.m. | OK | Java 11 | TESTS | 36 | 935 | 0 | ||
233494420 | tiger3768 | D | Nov. 19, 2023, 8 p.m. | OK | Java 17 | TESTS | 36 | 342 | 7884800 | ||
233476436 | puriabhijit000 | D | Nov. 19, 2023, 4:58 p.m. | OK | Java 17 | TESTS | 36 | 374 | 10956800 | ||
233484581 | Prime369 | D | Nov. 19, 2023, 6:10 p.m. | OK | Java 17 | TESTS | 36 | 483 | 9830400 | ||
233470579 | TCchen | D | Nov. 19, 2023, 4:26 p.m. | OK | Java 17 | TESTS | 36 | 514 | 13004800 | ||
233478176 | Dukkha | D | Nov. 19, 2023, 5:10 p.m. | OK | Java 17 | TESTS | 36 | 857 | 1228800 | ||
233464685 | TopCloser | D | Nov. 19, 2023, 4:07 p.m. | OK | Java 17 | TESTS | 36 | 998 | 32665600 | ||
233476986 | Sumitsingh7 | D | Nov. 19, 2023, 5:01 p.m. | OK | Java 8 | TESTS | 36 | 187 | 7577600 | ||
233462622 | Eslam_Ahmed | D | Nov. 19, 2023, 4 p.m. | OK | Java 8 | TESTS | 36 | 233 | 14643200 | ||
233462049 | Java_Programmer | D | Nov. 19, 2023, 3:58 p.m. | OK | Java 8 | TESTS | 36 | 249 | 17715200 | ||
233471447 | RMA-NB | D | Nov. 19, 2023, 4:28 p.m. | OK | Java 8 | TESTS | 36 | 358 | 23244800 | ||
233477957 | NerfThis | D | Nov. 19, 2023, 5:08 p.m. | OK | Java 8 | TESTS | 36 | 436 | 17408000 | ||
233519790 | priyaroy3370 | D | Nov. 20, 2023, 5:22 a.m. | OK | Java 8 | TESTS | 36 | 748 | 0 | ||
233516680 | sukaya | D | Nov. 20, 2023, 4:29 a.m. | OK | PyPy 3 | TESTS | 36 | 514 | 24678400 | ||
233463986 | Bryce3D | D | Nov. 19, 2023, 4:05 p.m. | OK | PyPy 3 | TESTS | 36 | 654 | 28467200 | ||
233471102 | AhsanRandhawa | D | Nov. 19, 2023, 4:27 p.m. | OK | PyPy 3 | TESTS | 36 | 670 | 20684800 | ||
233494000 | oneku16 | D | Nov. 19, 2023, 7:55 p.m. | OK | PyPy 3-64 | TESTS | 36 | 186 | 40140800 | ||
233504098 | abcsumits | D | Nov. 19, 2023, 10:57 p.m. | OK | PyPy 3-64 | TESTS | 36 | 187 | 40345600 | ||
233482145 | wish-nu | D | Nov. 19, 2023, 5:45 p.m. | OK | PyPy 3-64 | TESTS | 36 | 202 | 34816000 | ||
233464149 | Arpia | D | Nov. 19, 2023, 4:06 p.m. | OK | PyPy 3-64 | TESTS | 36 | 217 | 33484800 | ||
233506998 | RobinFromTheHood | D | Nov. 20, 2023, 12:30 a.m. | OK | PyPy 3-64 | TESTS | 36 | 218 | 40243200 | ||
233471506 | hxu10 | D | Nov. 19, 2023, 4:28 p.m. | OK | PyPy 3-64 | TESTS | 36 | 233 | 42291200 | ||
233516494 | YURAsuki | D | Nov. 20, 2023, 4:25 a.m. | OK | PyPy 3-64 | TESTS | 36 | 233 | 44544000 | ||
233476710 | Quick-One | D | Nov. 19, 2023, 4:59 p.m. | OK | PyPy 3-64 | TESTS | 36 | 249 | 34201600 | ||
233464363 | dirac_de | D | Nov. 19, 2023, 4:06 p.m. | OK | PyPy 3-64 | TESTS | 36 | 249 | 39116800 | ||
233476609 | JinYuManTang | D | Nov. 19, 2023, 4:59 p.m. | OK | PyPy 3-64 | TESTS | 36 | 265 | 37478400 | ||
233467917 | emelyan | D | Nov. 19, 2023, 4:17 p.m. | OK | Python 3 | TESTS | 36 | 342 | 36659200 | ||
233481751 | VeryLate | D | Nov. 19, 2023, 5:41 p.m. | OK | Python 3 | TESTS | 36 | 608 | 36659200 | ||
233464838 | aPNJ777 | D | Nov. 19, 2023, 4:08 p.m. | OK | Python 3 | TESTS | 36 | 702 | 36556800 | ||
233471133 | PugachAG | D | Nov. 19, 2023, 4:27 p.m. | OK | Rust 2021 | TESTS | 36 | 62 | 3174400 |
Back to search problems