Codeforces Round 1114 (Div. 3)

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
2254 Codeforces Round 1114 (Div. 3) FINISHED False 8100 2301884 Aug. 4, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 7083 ) E Chronostasis PROGRAMMING binary search data structures greedy

Yousef has a hidden array (a) of length (n) consisting entirely of strictly positive integers. An operation was performed exactly once to create an array (b): Set (b_1 = a_1). For every (i) from (2) to (n), set (b_i = a_i - a_{i-1}). After this, the elements of (b) were completely shuffled. You are given the shuffled array (b). Reconstruct the lexicographically smallest original array (a). If it's impossible for any arrangement of (b) to produce an array (a) of strictly positive integers, output (-1). The first line of input contains an integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains an integer (n) ((1 \le n \le 2 \cdot 10^5)) — the size of the array. The second line of each test case contains (n) integers (b_1, b_2, \dots, b_n) ((-10^9 \le b_i \le 10^9)) — the elements of the shuffled 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 (n) strictly positive integers (a_1, a_2, \dots, a_n) ((a_i \ge 1)) — the lexicographically smallest original array (a). If it's impossible to create a valid array (a), output (-1) instead. In the first test case, the only valid array is (a = 5). In the second test case, there is no valid arrangement of the elements of (b) that reconstructs an array (a) consisting entirely of strictly positive integers. Therefore, the answer is (-1). In the third test case, one valid arrangement reconstructs the array (a=1,1,3,2,6,3). The resulting sequence of differences (1, 0, 2, -1, 4, -3) is a permutation of the given array (b), and among all valid reconstructions, this array is lexicographically smallest.

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
385836539 DISHONOR E Aug. 6, 2026, 5:30 a.m. OK C++17 (GCC 7-32) TESTS 19 140 2764800
385805151 prabhankurcktd3704 E Aug. 5, 2026, 7:48 p.m. OK C++17 (GCC 7-32) TESTS 19 140 5222400
385705598 xixihaha666 E Aug. 5, 2026, 2:04 a.m. OK C++17 (GCC 7-32) TESTS 19 140 5222400
385704205 gucheng E Aug. 5, 2026, 1:41 a.m. OK C++17 (GCC 7-32) TESTS 19 140 5222400
385803629 kka_code E Aug. 5, 2026, 7:28 p.m. OK C++17 (GCC 7-32) TESTS 19 140 5324800
385672486 zl1341 E Aug. 4, 2026, 4:47 p.m. OK C++17 (GCC 7-32) TESTS 19 156 102400
385830721 Chickey146920 E Aug. 6, 2026, 3:55 a.m. OK C++17 (GCC 7-32) TESTS 19 156 3686400
385817524 amuerri E Aug. 6, 2026, 1:05 a.m. OK C++17 (GCC 7-32) TESTS 19 156 3686400
385794546 ggop123_12 E Aug. 5, 2026, 6:07 p.m. OK C++17 (GCC 7-32) TESTS 19 156 3686400
385673904 Insane_123 E Aug. 4, 2026, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 19 156 4300800
385670284 __kabbo6010__ E Aug. 4, 2026, 4:43 p.m. OK C++20 (GCC 13-64) TESTS 19 78 6144000
385720509 ByteRush E Aug. 5, 2026, 5:52 a.m. OK C++20 (GCC 13-64) TESTS 19 78 6451200
385701881 thanhson0411 E Aug. 5, 2026, 12:59 a.m. OK C++20 (GCC 13-64) TESTS 19 93 4812800
385832780 Scarl3th E Aug. 6, 2026, 4:31 a.m. OK C++20 (GCC 13-64) TESTS 19 93 8089600
385794534 SigmaBoy52Deadpool2013 E Aug. 5, 2026, 6:07 p.m. OK C++20 (GCC 13-64) TESTS 19 109 2867200
385671353 yunny_world E Aug. 4, 2026, 4:45 p.m. OK C++20 (GCC 13-64) TESTS 19 109 6860800
385811240 zhak_rr E Aug. 5, 2026, 9:46 p.m. OK C++20 (GCC 13-64) TESTS 19 109 7270400
385795759 Kamikazee112 E Aug. 5, 2026, 6:15 p.m. OK C++20 (GCC 13-64) TESTS 19 109 8192000
385672263 jayant002 E Aug. 4, 2026, 4:46 p.m. OK C++20 (GCC 13-64) TESTS 19 109 8294400
385839088 5311_Runtime_Terror E Aug. 6, 2026, 6:06 a.m. OK C++20 (GCC 13-64) TESTS 19 109 8499200
385797245 Tomori_Nao520 E Aug. 5, 2026, 6:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 819200
385673832 Ezzeldin_ E Aug. 4, 2026, 4:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 1024000
385765562 chris4321 E Aug. 5, 2026, 1:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 6041600
385698057 w114 E Aug. 4, 2026, 11:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 6451200
385818370 rahulkrt E Aug. 6, 2026, 1:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 6860800
385816884 blnyld4 E Aug. 6, 2026, 12:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 6860800
385800515 PriyanshuIITGHY2006 E Aug. 5, 2026, 6:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 8089600
385837139 HuyVu E Aug. 6, 2026, 5:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 8192000
385836679 bhs34 E Aug. 6, 2026, 5:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 8192000
385829370 Vasu_5 E Aug. 6, 2026, 3:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 109 8192000
385796392 pipylon E Aug. 5, 2026, 6:19 p.m. OK Go TESTS 19 375 12697600
385704797 saiyelmatwad13 E Aug. 5, 2026, 1:51 a.m. OK Java 21 TESTS 19 343 6246400
385672559 varora2004 E Aug. 4, 2026, 4:47 p.m. OK Java 21 TESTS 19 343 6246400
385672086 tabseer E Aug. 4, 2026, 4:46 p.m. OK Java 21 TESTS 19 375 9830400
385672560 RahulAhuja2901 E Aug. 4, 2026, 4:47 p.m. OK Java 21 TESTS 19 421 14028800
385672176 Azad_Singh E Aug. 4, 2026, 4:46 p.m. OK Java 21 TESTS 19 515 13414400
385671145 chefnav35 E Aug. 4, 2026, 4:44 p.m. OK Java 21 TESTS 19 531 9420800
385674338 Pavan__ E Aug. 4, 2026, 4:49 p.m. OK Java 21 TESTS 19 578 50688000
385830772 sriram_18 E Aug. 6, 2026, 3:56 a.m. OK Java 21 TESTS 19 625 18022400
385720904 NSaiAdvaith E Aug. 5, 2026, 5:56 a.m. OK Java 21 TESTS 19 640 22323200
385794009 TIMETABLE1 E Aug. 5, 2026, 6:04 p.m. OK Java 21 TESTS 19 734 18022400
385671964 lowkey_lakshay E Aug. 4, 2026, 4:46 p.m. OK Java 8 TESTS 19 203 16076800
385671060 Mr.Curious E Aug. 4, 2026, 4:44 p.m. OK Java 8 TESTS 19 468 19660800
385671081 Him4nshu-Trip4thi E Aug. 4, 2026, 4:44 p.m. OK Java 8 TESTS 19 828 19046400
385812880 user_not_found_404___ E Aug. 5, 2026, 10:36 p.m. OK PyPy 3-64 TESTS 19 234 27136000
385672920 mersonne E Aug. 4, 2026, 4:47 p.m. OK PyPy 3-64 TESTS 19 265 42803200
385671202 pulakbagaria E Aug. 4, 2026, 4:44 p.m. OK PyPy 3-64 TESTS 19 281 31641600
385831866 Shadow_tree E Aug. 6, 2026, 4:16 a.m. OK PyPy 3-64 TESTS 19 281 40755200
385698413 eugenekoran E Aug. 4, 2026, 11:37 p.m. OK PyPy 3-64 TESTS 19 296 27750400
385673807 jcharan E Aug. 4, 2026, 4:49 p.m. OK PyPy 3-64 TESTS 19 312 27238400
385716119 akimuuwu E Aug. 5, 2026, 4:55 a.m. OK PyPy 3-64 TESTS 19 343 31027200
385674036 sharpealpha E Aug. 4, 2026, 4:49 p.m. OK PyPy 3-64 TESTS 19 359 27852800
385669142 HereIamNow E Aug. 4, 2026, 4:41 p.m. OK PyPy 3-64 TESTS 19 375 27852800
385713431 the_seal E Aug. 5, 2026, 4:14 a.m. OK PyPy 3-64 TESTS 19 375 29593600
385671791 kartheek_2006 E Aug. 4, 2026, 4:46 p.m. OK Python 3 TESTS 19 531 47923200
385669084 mionacs_ E Aug. 4, 2026, 4:41 p.m. OK Python 3 TESTS 19 578 34304000
385834172 chmpro E Aug. 6, 2026, 4:54 a.m. OK Python 3 TESTS 19 625 28569600
385718806 adityaa6 E Aug. 5, 2026, 5:30 a.m. OK Python 3 TESTS 19 1484 53657600
385697399 Phenanthrene86 E Aug. 4, 2026, 11:13 p.m. OK Python 3 TESTS 19 1703 27443200
385713707 timeplz E Aug. 5, 2026, 4:18 a.m. OK Python 3 TESTS 19 1750 33792000
385821386 AdrianKnox2000 E Aug. 6, 2026, 2:04 a.m. OK Python 3 TESTS 19 1781 65433600
385827704 kroyl E Aug. 6, 2026, 3:13 a.m. OK Rust 2024 TESTS 19 62 8499200
385716336 Tantellam E Aug. 5, 2026, 4:58 a.m. OK Rust 2024 TESTS 19 78 3788800
385674397 superoles E Aug. 4, 2026, 4:49 p.m. OK Rust 2024 TESTS 19 140 27136000

remove filters

Back to search problems