Codeforces Round 961 (Div. 2)

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
1995 Codeforces Round 961 (Div. 2) FINISHED False 7200 54660323 July 23, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 508 ) E1 Let Me Teach You a Lesson (Easy Version) PROGRAMMING 2-sat data structures dp two pointers

This is the easy version of a problem. The only difference between an easy and a hard version is the constraints on t and n . You can make hacks only if both versions of the problem are solved. Arthur is giving a lesson to his famous 2 n knights. Like any other students, they're sitting at the desks in pairs, but out of habit in a circle. The knight 2 i - 1 is sitting at the desk with the knight 2 i . Each knight has intelligence, which can be measured by an integer. Let's denote the intelligence of the i -th knight as a_i . Arthur wants the maximal difference in total intelligence over all pairs of desks to be as small as possible. More formally, he wants to minimize max limits_{1 <= i <= n} (a_{2 i - 1} + a_{2 i}) - min limits_{1 <= i <= n} (a_{2 i - 1} + a_{2 i}) . However, the Code of Chivalry only allows swapping the opposite knights in the circle, i.e., Arthur can simultaneously perform a_i := a_{i + n} , a_{i + n} := a_i for any 1 <= i <= n . Arthur can make any number of such swaps. What is the best result he can achieve? Each test consists of several test cases. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. It is followed by descriptions of the test cases. The first line of each test case contains a single integer n ( 1 <= n <= 2000 ) -- the number of desks. The second line consists of 2n integers a_1, a_2, ldots, a_{2 n} ( 1 <= a_i <= 10^9 ) -- the intelligence values of the knights. It is guaranteed that the sum of n over all test cases does not exceed 2000 . For each test case, output a single line containing one integer -- the minimal difference Arthur can achieve. In the first test case, Arthur can swap the second and the fourth knights. Then the total intelligence at both desks will be 10 . In the third test case, Arthur can make 0 operations, which will resul

Tutorials

Video Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
272245140 Franklzh E1 July 24, 2024, 3:57 a.m. OK C++14 (GCC 6-32) TESTS 66 358 259174400
272218214 omeganot E1 July 23, 2024, 9:16 p.m. OK C++14 (GCC 6-32) TESTS 66 421 0
272236195 hqmm E1 July 24, 2024, 2:29 a.m. OK C++14 (GCC 6-32) TESTS 66 827 20070400
272243258 QZJ114514 E1 July 24, 2024, 3:36 a.m. OK C++14 (GCC 6-32) TESTS 66 1156 204800
272219509 Imagine.2019 E1 July 23, 2024, 9:39 p.m. OK C++17 (GCC 7-32) TESTS 66 77 0
272202297 TooTrashyToCompete E1 July 23, 2024, 6:19 p.m. OK C++17 (GCC 7-32) TESTS 66 281 102400
272174326 liympanda E1 July 23, 2024, 5:13 p.m. OK C++17 (GCC 7-32) TESTS 66 359 1638400
272176072 Kilani E1 July 23, 2024, 5:22 p.m. OK C++17 (GCC 7-32) TESTS 66 467 3993600
272234529 Sparkle_Twilight E1 July 24, 2024, 2:12 a.m. OK C++17 (GCC 7-32) TESTS 66 499 0
272232427 Wael_Zaiback E1 July 24, 2024, 1:47 a.m. OK C++17 (GCC 7-32) TESTS 66 499 0
272207462 ikrpprppp E1 July 23, 2024, 7:04 p.m. OK C++17 (GCC 7-32) TESTS 66 577 0
272223512 SoSmart E1 July 23, 2024, 11:11 p.m. OK C++17 (GCC 7-32) TESTS 66 1327 0
272239679 hhhyh E1 July 24, 2024, 3:02 a.m. OK C++17 (GCC 7-32) TESTS 66 1546 0
272198333 LBR E1 July 23, 2024, 5:51 p.m. OK C++17 (GCC 7-32) TESTS 66 2000 42086400
272245716 LNian E1 July 24, 2024, 4:03 a.m. OK C++20 (GCC 13-64) TESTS 66 62 0
272195581 neal E1 July 23, 2024, 5:34 p.m. OK C++20 (GCC 13-64) TESTS 66 62 0
272174381 BurnedChicken E1 July 23, 2024, 5:13 p.m. OK C++20 (GCC 13-64) TESTS 66 62 0
272199185 neal E1 July 23, 2024, 5:57 p.m. OK C++20 (GCC 13-64) TESTS 66 62 102400
272240288 lprdsb E1 July 24, 2024, 3:08 a.m. OK C++20 (GCC 13-64) TESTS 66 62 20889600
272220435 kaiboy E1 July 23, 2024, 9:59 p.m. OK C++20 (GCC 13-64) TESTS 66 62 26521600
272201086 neal E1 July 23, 2024, 6:10 p.m. OK C++20 (GCC 13-64) TESTS 66 77 0
272192645 lunchbox E1 July 23, 2024, 5:32 p.m. OK C++20 (GCC 13-64) TESTS 66 77 102400
272209941 Dominater069 E1 July 23, 2024, 7:30 p.m. OK C++20 (GCC 13-64) TESTS 66 77 2048000
272204944 LipArcanjo E1 July 23, 2024, 6:40 p.m. OK C++20 (GCC 13-64) TESTS 66 77 3276800
272256391 Knightforces E1 July 24, 2024, 5:55 a.m. OK GNU C11 TESTS 66 77 8294400
272195550 misorin E1 July 23, 2024, 5:34 p.m. OK PyPy 3-64 TESTS 66 546 8806400
272176914 misorin E1 July 23, 2024, 5:26 p.m. OK PyPy 3-64 TESTS 66 1592 8601600
272174149 toam E1 July 23, 2024, 5:13 p.m. OK PyPy 3-64 TESTS 66 1921 9728000
272249750 M1ngXu E1 July 24, 2024, 4:49 a.m. OK Rust 2021 TESTS 66 1843 0

remove filters

Back to search problems