Codeforces Round 1053 (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
2151 Codeforces Round 1053 (Div. 2) FINISHED False 11700 17691922 Sept. 24, 2025, 11:35 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 10171 ) C Incremental Stay PROGRAMMING greedy implementation

You are the security guard of a museum. The main door of the museum is both an entrance and an exit. At most one person can pass through the door every second. There is a sensor that detects when a visitor passes through the door. The sensor cannot determine neither who the visitor is, nor whether he entered or exited the museum. The sensor detected some activity in (2n) distinct moments of time (a_1, a_2, \ldots, a_{2n}) (measured in seconds). For each visitor, his stay time is equal to the exit time minus the entrance time. Right now the museum is closed (so it has no visitors), and you wonder about the maximum possible total stay time today, i.e., the maximum possible sum of the stay times of all the visitors that entered the museum today. At second (0), the museum was closed as well. For security reasons, there is also a limit on the number of people who can stay in the museum simultaneously, but you forgot this limit. For each (k) from (1) to (n), you want to determine the maximum possible total stay time today, assuming that at most (k) people can stay in the museum simultaneously. 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 integer (n) ((1 \leq n \leq 2 \cdot 10^5)), indicating that the sensor detected some activity in (2n) distinct moments of time. The second line of each test case contains (2n) integers (a_1, a_2, \ldots, a_{2n}) ((1 \leq a_1 < a_2 < \ldots < a_{2n} \leq 10^9)) — the seconds when the sensor detected some activity. It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, print (n) integers: for each (k) from (1) to (n), print the maximum possible total stay time today, assuming that at most (k) people can stay in the museum simultan

Tutorials

Editorial of Codeforces Round 1053 (Div. 1, Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
340289297 x.ing C Sept. 25, 2025, 5:09 a.m. OK C++17 (GCC 7-32) TESTS 9 171 0
340279303 cimcle C Sept. 25, 2025, 3:08 a.m. OK C++17 (GCC 7-32) TESTS 9 171 0
340189694 Rairn C Sept. 24, 2025, 1:22 p.m. OK C++17 (GCC 7-32) TESTS 9 171 1638400
340200475 Single_Ready_To_Mingle C Sept. 24, 2025, 2:02 p.m. OK C++17 (GCC 7-32) TESTS 9 171 3174400
340201143 zbwcf C Sept. 24, 2025, 2:05 p.m. OK C++17 (GCC 7-32) TESTS 9 171 5734400
340291541 yuxuzhehuan C Sept. 25, 2025, 5:29 a.m. OK C++17 (GCC 7-32) TESTS 9 171 8089600
340287781 CoDeR__BrO C Sept. 25, 2025, 4:52 a.m. OK C++17 (GCC 7-32) TESTS 9 171 9011200
340252608 o_elyas C Sept. 24, 2025, 7:28 p.m. OK C++17 (GCC 7-32) TESTS 9 186 0
340292181 sossos5989 C Sept. 25, 2025, 5:34 a.m. OK C++17 (GCC 7-32) TESTS 9 186 921600
340291865 Adith1000 C Sept. 25, 2025, 5:31 a.m. OK C++17 (GCC 7-32) TESTS 9 186 921600
340280103 _andyli C Sept. 25, 2025, 3:18 a.m. OK C++20 (GCC 13-64) TESTS 9 77 9318400
340192330 convie C Sept. 24, 2025, 1:32 p.m. OK C++20 (GCC 13-64) TESTS 9 93 99328000
340197373 ironwaste C Sept. 24, 2025, 1:50 p.m. OK C++20 (GCC 13-64) TESTS 9 108 921600
340280023 oyasumi_sion C Sept. 25, 2025, 3:17 a.m. OK C++20 (GCC 13-64) TESTS 9 124 0
340257064 ashishk.it18 C Sept. 24, 2025, 8:19 p.m. OK C++20 (GCC 13-64) TESTS 9 124 0
340250845 notsofast_94 C Sept. 24, 2025, 7:15 p.m. OK C++20 (GCC 13-64) TESTS 9 124 0
340192355 xiaoguanczhaUWU C Sept. 24, 2025, 1:32 p.m. OK C++20 (GCC 13-64) TESTS 9 124 0
340278456 yuzong437 C Sept. 25, 2025, 2:54 a.m. OK C++20 (GCC 13-64) TESTS 9 124 819200
340216042 arohanh C Sept. 24, 2025, 3:39 p.m. OK C++20 (GCC 13-64) TESTS 9 124 921600
340192185 VasuBhakt C Sept. 24, 2025, 1:31 p.m. OK C++20 (GCC 13-64) TESTS 9 124 921600
340212615 Kaedemaple C Sept. 24, 2025, 2:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 93 13824000
340292314 Zorojuro C Sept. 25, 2025, 5:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340279711 jjyydd C Sept. 25, 2025, 3:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340267322 K_Tumi_Bakul C Sept. 25, 2025, 12:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340253831 zzh.free C Sept. 24, 2025, 7:39 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340252600 MrWizard_574 C Sept. 24, 2025, 7:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340208234 theUB_02 C Sept. 24, 2025, 2:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340199383 mpboss C Sept. 24, 2025, 1:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340196656 UltraMad C Sept. 24, 2025, 1:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340196230 lambda-__-delta4477 C Sept. 24, 2025, 1:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 9 124 0
340197357 ruban C Sept. 24, 2025, 1:50 p.m. OK FPC TESTS 9 359 62668800
340207281 1435730 C Sept. 24, 2025, 2:31 p.m. OK GNU C11 TESTS 9 202 3174400
340257640 Mahir_Uddin C Sept. 24, 2025, 8:27 p.m. OK GNU C11 TESTS 9 1015 4915200
340219670 avighnakc C Sept. 24, 2025, 4:04 p.m. OK GNU C11 TESTS 9 1030 6553600
340218218 ArvanTavanMynga C Sept. 24, 2025, 3:53 p.m. OK GNU C11 TESTS 9 1093 12902400
340194168 glebsamsonov C Sept. 24, 2025, 1:38 p.m. OK Go TESTS 9 484 9113600
340204930 treasuryonly C Sept. 24, 2025, 2:22 p.m. OK Haskell TESTS 9 889 193228800
340199524 22BCS_KRG_IOT-3 C Sept. 24, 2025, 1:58 p.m. OK Java 21 TESTS 9 327 11673600
340190376 BiggestFish06 C Sept. 24, 2025, 1:25 p.m. OK Java 21 TESTS 9 374 2969600
340208606 Pratyush_2612 C Sept. 24, 2025, 2:35 p.m. OK Java 21 TESTS 9 390 10035200
340287558 InfinityX C Sept. 25, 2025, 4:50 a.m. OK Java 21 TESTS 9 390 10240000
340189262 anshwww C Sept. 24, 2025, 1:21 p.m. OK Java 21 TESTS 9 421 20684800
340195379 _MShadow_ C Sept. 24, 2025, 1:43 p.m. OK Java 21 TESTS 9 437 18841600
340188972 D_Cod3r C Sept. 24, 2025, 1:20 p.m. OK Java 21 TESTS 9 452 21094400
340193793 prashanthit8074 C Sept. 24, 2025, 1:37 p.m. OK Java 21 TESTS 9 452 21196800
340280206 Yousef_Badr C Sept. 25, 2025, 3:19 a.m. OK Java 21 TESTS 9 468 7168000
340245438 krishnakulange C Sept. 24, 2025, 6:34 p.m. OK Java 21 TESTS 9 468 9011200
340196678 realSteel24 C Sept. 24, 2025, 1:47 p.m. OK Java 8 TESTS 9 281 19353600
340189260 NeelmaniPandey09 C Sept. 24, 2025, 1:21 p.m. OK Java 8 TESTS 9 639 78950400
340189567 tarunaggarwal0211 C Sept. 24, 2025, 1:22 p.m. OK Java 8 TESTS 9 718 20172800
340197630 kevin_0911 C Sept. 24, 2025, 1:51 p.m. OK Java 8 TESTS 9 796 20377600
340278104 fox_arrow__ C Sept. 25, 2025, 2:48 a.m. OK PyPy 3 TESTS 9 983 37580800
340204719 e11sy C Sept. 24, 2025, 2:21 p.m. OK PyPy 3 TESTS 9 999 48230400
340262799 Arvind215271 C Sept. 24, 2025, 9:57 p.m. OK PyPy 3-64 TESTS 9 217 56012800
340188699 Horse-chan C Sept. 24, 2025, 1:19 p.m. OK PyPy 3-64 TESTS 9 218 46694400
340194032 FyReX_KING635 C Sept. 24, 2025, 1:38 p.m. OK PyPy 3-64 TESTS 9 218 52531200
340234721 ibraheemkureshi C Sept. 24, 2025, 5:23 p.m. OK PyPy 3-64 TESTS 9 218 55910400
340267851 snowythecat C Sept. 25, 2025, 12:13 a.m. OK PyPy 3-64 TESTS 9 218 62566400
340189207 udayan8 C Sept. 24, 2025, 1:21 p.m. OK PyPy 3-64 TESTS 9 233 62976000
340195901 ariam_ C Sept. 24, 2025, 1:45 p.m. OK PyPy 3-64 TESTS 9 249 55910400
340190450 EmeraldBeast C Sept. 24, 2025, 1:25 p.m. OK PyPy 3-64 TESTS 9 249 55910400
340264785 explainer C Sept. 24, 2025, 10:59 p.m. OK PyPy 3-64 TESTS 9 249 56012800
340193953 flownn C Sept. 24, 2025, 1:38 p.m. OK PyPy 3-64 TESTS 9 249 56217600
340205796 focus_faith_137 C Sept. 24, 2025, 2:25 p.m. OK Python 3 TESTS 9 343 48844800
340238204 Viswa_M_17 C Sept. 24, 2025, 5:46 p.m. OK Python 3 TESTS 9 436 50380800
340242293 good_angel C Sept. 24, 2025, 6:15 p.m. OK Python 3 TESTS 9 452 48640000
340200034 jsbiwnkdjvw C Sept. 24, 2025, 2 p.m. OK Python 3 TESTS 9 499 50688000
340216796 hemanthbommadi67 C Sept. 24, 2025, 3:43 p.m. OK Python 3 TESTS 9 499 96665600
340285576 aaditya.samadhiya11 C Sept. 25, 2025, 4:24 a.m. OK Python 3 TESTS 9 515 62566400
340189399 durgeshpatel C Sept. 24, 2025, 1:21 p.m. OK Python 3 TESTS 9 561 99430400
340202688 Legendary_CP C Sept. 24, 2025, 2:12 p.m. OK Python 3 TESTS 9 593 62361600
340202979 yrjzs C Sept. 24, 2025, 2:14 p.m. OK Python 3 TESTS 9 609 47820800
340207617 lovmilkdragon C Sept. 24, 2025, 2:32 p.m. OK Python 3 TESTS 9 609 48025600

remove filters

Back to search problems