Order Capital Round 1 (Codeforces Round 1038, Div. 1 + 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
2122 Order Capital Round 1 (Codeforces Round 1038, Div. 1 + Div. 2) FINISHED False 8100 23469923 July 19, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 8325 ) C Manhattan Pairs PROGRAMMING constructive algorithms greedy math sortings

You are given (n) points ((x_i, y_i)) on a 2D plane, where (n) is even. Select (\tfrac{n}{2}) disjoint pairs ((a_i, b_i)) to maximize the sum of Manhattan distances between points in pairs. In other words, maximize ()\sum_{i=1}^{n/2} |x_{a_i} - x_{b_i}| + |y_{a_i} - y_{b_i}|.() Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single even integer (n) ((2 \leq n \leq 2 \cdot 10^5)) — the number of points. The (i)-th of the next (n) lines contains two integers (x_i) and (y_i) ((-10^6 \le x_i, y_i \le 10^6)) — the coordinates of the (i)-th point. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output (\tfrac{n}{2}) lines, the (i)-th line containing two integers (a_i) and (b_i) — the indices of points in the (i)-th pair. If there are multiple solutions, print any of them. In the first test case, an optimal solution is to select the pairs ((1, 4)) and ((2, 3)), which achieves a distance sum of (5 + 3 = 8). In the second test case, an optimal solution is to select the pairs ((1, 8)), ((9, 10)), ((5, 7)), ((2, 3)), ((4, 6)), which achieves a distance sum of (4 + 7 + 10 + 5 + 7 = 33).

Tutorials

Order Capital Round 1 (Codeforces Round 1038, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
329900064 Jimmyia C July 19, 2025, 8:24 p.m. OK C++17 (GCC 7-32) TESTS 12 124 0
329899970 Jimmyia C July 19, 2025, 8:22 p.m. OK C++17 (GCC 7-32) TESTS 12 124 0
329881667 wistful23 C July 19, 2025, 5:23 p.m. OK C++17 (GCC 7-32) TESTS 12 124 0
329913028 hzk_cpp C July 20, 2025, 1:27 a.m. OK C++17 (GCC 7-32) TESTS 12 124 1945600
329872263 maxinyan C July 19, 2025, 4:36 p.m. OK C++17 (GCC 7-32) TESTS 12 124 2457600
329872825 _Amrndr_ C July 19, 2025, 4:38 p.m. OK C++17 (GCC 7-32) TESTS 12 124 2662400
329874831 Harsh.Ranjan C July 19, 2025, 4:42 p.m. OK C++17 (GCC 7-32) TESTS 12 124 3174400
329868347 sanjay289 C July 19, 2025, 4:27 p.m. OK C++17 (GCC 7-32) TESTS 12 124 4403200
329886999 akshat_yadav_5 C July 19, 2025, 6 p.m. OK C++17 (GCC 7-32) TESTS 12 124 4915200
329880862 MisstianoPenaldo1 C July 19, 2025, 5:18 p.m. OK C++17 (GCC 7-32) TESTS 12 124 5120000
329925256 alextherunner C July 20, 2025, 5:03 a.m. OK C++20 (GCC 13-64) TESTS 12 93 102400
329891603 Crmej C July 19, 2025, 6:40 p.m. OK C++20 (GCC 13-64) TESTS 12 93 102400
329887991 SherLocked25 C July 19, 2025, 6:08 p.m. OK C++20 (GCC 13-64) TESTS 12 93 102400
329915323 Arman42 C July 20, 2025, 2:20 a.m. OK C++20 (GCC 13-64) TESTS 12 93 1126400
329898958 iitian_adda_iitk C July 19, 2025, 8:08 p.m. OK C++20 (GCC 13-64) TESTS 12 93 1228800
329883646 xlab C July 19, 2025, 5:36 p.m. OK C++20 (GCC 13-64) TESTS 12 93 1638400
329874762 Inkpear C July 19, 2025, 4:42 p.m. OK C++20 (GCC 13-64) TESTS 12 93 2457600
329878302 chhhcooh C July 19, 2025, 4:49 p.m. OK C++20 (GCC 13-64) TESTS 12 93 3072000
329916658 fengxiabcd C July 20, 2025, 2:44 a.m. OK C++20 (GCC 13-64) TESTS 12 93 5939200
329923962 adithyahegdek C July 20, 2025, 4:44 a.m. OK C++20 (GCC 13-64) TESTS 12 108 0
329868658 awol777 C July 19, 2025, 4:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 77 614400
329915423 ddbjiang C July 20, 2025, 2:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 93 0
329892745 21cs02001 C July 19, 2025, 6:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 93 102400
329927988 Septemper C July 20, 2025, 5:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 93 409600
329868508 koizy C July 19, 2025, 4:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 93 1843200
329888883 SayAnAditya_1by0 C July 19, 2025, 6:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 93 2457600
329916172 ZenithHacker C July 20, 2025, 2:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 93 2764800
329893497 Dr_Zhang C July 19, 2025, 7 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 108 0
329883317 ibrm C July 19, 2025, 5:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 12 108 0
329929333 Nanako7_ix C July 20, 2025, 5:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 108 102400
329913449 ruban C July 20, 2025, 1:39 a.m. OK FPC TESTS 12 452 145510400
329878499 alpha00007 C July 19, 2025, 4:49 p.m. OK Go TESTS 12 359 26521600
329927603 priyaroy3370 C July 20, 2025, 5:34 a.m. OK Java 21 TESTS 12 359 33689600
329928782 priyaroy3370 C July 20, 2025, 5:48 a.m. OK Java 21 TESTS 12 359 34918400
329873825 PraachiRasane C July 19, 2025, 4:40 p.m. OK Java 21 TESTS 12 389 5734400
329868205 nantaotuo C July 19, 2025, 4:27 p.m. OK Java 21 TESTS 12 421 7987200
329907346 Bogys C July 19, 2025, 10:24 p.m. OK Java 21 TESTS 12 421 15257600
329882857 mastacoda C July 19, 2025, 5:31 p.m. OK Java 21 TESTS 12 437 7372800
329884997 Balu2907 C July 19, 2025, 5:45 p.m. OK Java 21 TESTS 12 437 7680000
329885150 Balu2907 C July 19, 2025, 5:46 p.m. OK Java 21 TESTS 12 452 7372800
329888419 NpHardcore_05 C July 19, 2025, 6:12 p.m. OK Java 21 TESTS 12 452 20992000
329886584 feonex C July 19, 2025, 5:57 p.m. OK Java 21 TESTS 12 468 19660800
329868213 leonlian C July 19, 2025, 4:27 p.m. OK Java 8 TESTS 12 280 5222400
329872377 kumar-anish02102006 C July 19, 2025, 4:37 p.m. OK Java 8 TESTS 12 343 2355200
329869578 neerajreddy20 C July 19, 2025, 4:30 p.m. OK Java 8 TESTS 12 358 3481600
329918539 xmjlove C July 20, 2025, 3:16 a.m. OK Java 8 TESTS 12 374 5939200
329869178 rishi_140603 C July 19, 2025, 4:29 p.m. OK Java 8 TESTS 12 406 3276800
329893219 kasiru_69 C July 19, 2025, 6:57 p.m. OK Java 8 TESTS 12 546 2048000
329869107 huixiong C July 19, 2025, 4:29 p.m. OK Java 8 TESTS 12 578 0
329922165 bt22cse036 C July 20, 2025, 4:14 a.m. OK Java 8 TESTS 12 999 204800
329867893 Sanya_79 C July 19, 2025, 4:26 p.m. OK Java 8 TESTS 12 1077 4300800
329869823 yashbansal99 C July 19, 2025, 4:30 p.m. OK Java 8 TESTS 12 1109 4403200
329876565 _Zuno_ C July 19, 2025, 4:46 p.m. OK Node.js TESTS 12 733 117862400
329871307 amanjotsingh09 C July 19, 2025, 4:34 p.m. OK PyPy 3 TESTS 12 952 27545600
329887868 DSKroc C July 19, 2025, 6:07 p.m. OK PyPy 3 TESTS 12 1046 180428800
329870417 grecil C July 19, 2025, 4:32 p.m. OK PyPy 3 TESTS 12 1264 43724800
329902549 darkky C July 19, 2025, 9:03 p.m. OK PyPy 3 TESTS 12 1265 51609600
329877162 Yunbvfrty C July 19, 2025, 4:47 p.m. OK PyPy 3 TESTS 12 1562 46080000
329872792 abhinavnadda2003 C July 19, 2025, 4:38 p.m. OK PyPy 3 TESTS 12 1609 23961600
329901686 kavorka C July 19, 2025, 8:48 p.m. OK PyPy 3-64 TESTS 12 390 54476800
329878414 Prophet05 C July 19, 2025, 4:49 p.m. OK PyPy 3-64 TESTS 12 405 75571200
329881170 miya145592 C July 19, 2025, 5:19 p.m. OK PyPy 3-64 TESTS 12 452 49254400
329886683 minuki646 C July 19, 2025, 5:58 p.m. OK PyPy 3-64 TESTS 12 452 55296000
329912584 Little_Sheep_Yawn C July 20, 2025, 1:17 a.m. OK PyPy 3-64 TESTS 12 467 46080000
329900080 KidusHawoltu C July 19, 2025, 8:24 p.m. OK PyPy 3-64 TESTS 12 499 41472000
329898019 Mostafa_Alaa99 C July 19, 2025, 7:55 p.m. OK PyPy 3-64 TESTS 12 499 61337600
329924364 jvatsal0709 C July 20, 2025, 4:50 a.m. OK PyPy 3-64 TESTS 12 515 41676800
329881262 OAY71011 C July 19, 2025, 5:20 p.m. OK PyPy 3-64 TESTS 12 515 52224000
329913521 anuj_m C July 20, 2025, 1:41 a.m. OK PyPy 3-64 TESTS 12 530 58470400
329877483 DinamitaXXL C July 19, 2025, 4:48 p.m. OK Python 3 TESTS 12 296 100147200
329881291 cioppy C July 19, 2025, 5:20 p.m. OK Python 3 TESTS 12 531 36659200
329875224 chayan381 C July 19, 2025, 4:43 p.m. OK Python 3 TESTS 12 546 75571200
329882416 Jaijnuak C July 19, 2025, 5:28 p.m. OK Python 3 TESTS 12 593 43929600
329875368 Harry911 C July 19, 2025, 4:43 p.m. OK Python 3 TESTS 12 655 88371200
329872927 brindasoneji06 C July 19, 2025, 4:38 p.m. OK Python 3 TESTS 12 734 43827200
329875181 ARTURMIR C July 19, 2025, 4:43 p.m. OK Python 3 TESTS 12 749 59392000
329878013 sanidhya_kun C July 19, 2025, 4:48 p.m. OK Python 3 TESTS 12 749 88371200
329901549 MirazHossain_847 C July 19, 2025, 8:46 p.m. OK Python 3 TESTS 12 781 51916800
329877514 yash3003 C July 19, 2025, 4:48 p.m. OK Python 3 TESTS 12 859 56217600
329870832 RustyQuantPP C July 19, 2025, 4:33 p.m. OK Rust 2021 TESTS 12 77 102400
329868265 Spheniscine C July 19, 2025, 4:27 p.m. OK Rust 2021 TESTS 12 93 7987200
329924276 Spheniscine C July 20, 2025, 4:49 a.m. OK Rust 2021 TESTS 12 109 5222400
329899609 Martician C July 19, 2025, 8:17 p.m. OK Rust 2021 TESTS 12 140 10547200
329873064 davidmiheev C July 19, 2025, 4:38 p.m. OK Rust 2021 TESTS 12 311 14233600

remove filters

Back to search problems