Codeforces Round 860 (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
1798 Codeforces Round 860 (Div. 2) FINISHED False 7200 51981899 March 26, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 10172 ) D Shocking Arrangement PROGRAMMING constructive algorithms greedy math 1600

B'You are given an array a_1, a_2, ldots, a_n consisting of integers such that a_1 + a_2 + ldots + a_n = 0 . You have to rearrange the elements of the array a so that the following condition is satisfied: max limits_{1 <= l <= r <= n} lvert a_l + a_{l+1} + ldots + a_r rvert < max(a_1, a_2, ldots, a_n) - min(a_1, a_2, ldots, a_n), where |x| denotes the absolute value of x . More formally, determine if there exists a permutation p_1, p_2, ldots, p_n that for the array a_{p_1}, a_{p_2}, ldots, a_{p_n} , the condition above is satisfied, and find the corresponding array. Recall that the array p_1, p_2, ldots, p_n is called a permutation if for each integer x from 1 to n there is exactly one i from 1 to n such that p_i = x . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 50 ,000 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 300 ,000 ) -- the length of the array a . The second line of each test case contains n integers a_1, a_2, ldots, a_n ( -10^9 <= a_i <= 10^9 ) -- elements of the array a . It is guaranteed that the sum of the array a is zero, in other words: a_1 + a_2 + ldots + a_n = 0 . It is guaranteed that the sum of n over all test cases does not exceed 300 ,000 . For each test case, if it is impossible to rearrange the elements of the array a in the required way, print "No" in a single line. If possible, print "Yes" in the first line, and then in a separate line n numbers -- elements a_1, a_2, ldots, a_n rearranged in a valid order ( a_{p_1}, a_{p_2}, ldots, a_{p_n} ). If there are several possible answers, you can output any of them. In the first test case max(a_1, ldots, a_n) - min(a_1, ldots, a_n) = 9 '...

Tutorials

Editorial of Codeforces Round 860 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
199445563 mban259 D March 27, 2023, 5:42 p.m. OK C# 10 TESTS 47 171 72499200 1600
199431716 Francesco481 D March 27, 2023, 3:44 p.m. OK GNU C++14 TESTS 47 155 4403200 1600
199400953 riri. D March 27, 2023, 11:44 a.m. OK GNU C++14 TESTS 47 155 7168000 1600
199531214 wsyhb D March 28, 2023, 12:13 p.m. OK GNU C++14 TESTS 47 171 1536000 1600
200067791 Lucky_Glass D April 1, 2023, 3:26 a.m. OK GNU C++14 TESTS 47 171 2355200 1600
199777656 2018ljw D March 30, 2023, 3:43 a.m. OK GNU C++14 TESTS 47 171 2355200 1600
199631176 JiangRH D March 29, 2023, 7:38 a.m. OK GNU C++14 TESTS 47 171 2457600 1600
199585147 Andwerp D March 28, 2023, 7:34 p.m. OK GNU C++14 TESTS 47 171 2764800 1600
199526965 kiropo D March 28, 2023, 11:40 a.m. OK GNU C++14 TESTS 47 171 3584000 1600
199838620 _zay D March 30, 2023, 2:28 p.m. OK GNU C++14 TESTS 47 171 4300800 1600
199737485 jogeshwar01 D March 29, 2023, 5:28 p.m. OK GNU C++14 TESTS 47 171 4403200 1600
199779228 SwordFlame D March 30, 2023, 4:15 a.m. OK GNU C++17 TESTS 47 93 2457600 1600
199729306 SteamTurbine D March 29, 2023, 4:11 p.m. OK GNU C++17 TESTS 47 156 1228800 1600
199761075 snacache D March 29, 2023, 9:52 p.m. OK GNU C++17 TESTS 47 156 3891200 1600
199400265 YamanAbdullah D March 27, 2023, 11:38 a.m. OK GNU C++17 TESTS 47 170 1228800 1600
199453046 fortypercentyaar D March 27, 2023, 6:56 p.m. OK GNU C++17 TESTS 47 170 4403200 1600
199402301 Mtaylor D March 27, 2023, 11:56 a.m. OK GNU C++17 TESTS 47 170 4403200 1600
199901160 lllei D March 31, 2023, 3:08 a.m. OK GNU C++17 TESTS 47 171 1228800 1600
199707131 Capps D March 29, 2023, 1:21 p.m. OK GNU C++17 TESTS 47 171 1228800 1600
199675110 abcpony D March 29, 2023, 10:30 a.m. OK GNU C++17 TESTS 47 171 1228800 1600
199540694 Brovko D March 28, 2023, 1:26 p.m. OK GNU C++17 TESTS 47 171 1228800 1600
199415932 Lwchicky0 D March 27, 2023, 1:44 p.m. OK GNU C++17 (64) TESTS 47 124 1843200 1600
199481375 TeFuir123455 D March 28, 2023, 2:25 a.m. OK GNU C++17 (64) TESTS 47 124 2457600 1600
199425788 s8x D March 27, 2023, 2:56 p.m. OK GNU C++17 (64) TESTS 47 124 4096000 1600
199612829 vjudge2 D March 29, 2023, 3:19 a.m. OK GNU C++17 (64) TESTS 47 124 4812800 1600
199479885 chiruno233 D March 28, 2023, 1:51 a.m. OK GNU C++17 (64) TESTS 47 124 5427200 1600
199416885 INF_512 D March 27, 2023, 1:51 p.m. OK GNU C++17 (64) TESTS 47 124 6758400 1600
199930103 Shukuang D March 31, 2023, 10:03 a.m. OK GNU C++17 (64) TESTS 47 124 7270400 1600
199430117 luckmaster D March 27, 2023, 3:32 p.m. OK GNU C++17 (64) TESTS 47 139 8806400 1600
200027772 monkey8 D March 31, 2023, 5:36 p.m. OK GNU C++17 (64) TESTS 47 140 1331200 1600
199735291 andreas D March 29, 2023, 5:07 p.m. OK GNU C++17 (64) TESTS 47 140 2457600 1600
199949112 1eave D March 31, 2023, 1:12 p.m. OK GNU C++20 (64) TESTS 47 93 1228800 1600
199870103 _WhiteWine_ D March 30, 2023, 6:22 p.m. OK GNU C++20 (64) TESTS 47 93 1228800 1600
199831467 hcywoi D March 30, 2023, 1:45 p.m. OK GNU C++20 (64) TESTS 47 93 1228800 1600
199562757 Alex_Sense1 D March 28, 2023, 4:10 p.m. OK GNU C++20 (64) TESTS 47 93 1228800 1600
199490574 Lion_Heart D March 28, 2023, 5:03 a.m. OK GNU C++20 (64) TESTS 47 93 1228800 1600
199490540 Tourist-Egypt D March 28, 2023, 5:03 a.m. OK GNU C++20 (64) TESTS 47 93 1228800 1600
199427058 eternal_happiness D March 27, 2023, 3:06 p.m. OK GNU C++20 (64) TESTS 47 93 1228800 1600
199401237 flyfeng D March 27, 2023, 11:47 a.m. OK GNU C++20 (64) TESTS 47 93 1228800 1600
199789819 s7win99 D March 30, 2023, 6:51 a.m. OK GNU C++20 (64) TESTS 47 93 2457600 1600
199739095 Theo830 D March 29, 2023, 5:42 p.m. OK GNU C++20 (64) TESTS 47 93 2457600 1600
199481587 harsh.awasthi D March 28, 2023, 2:31 a.m. OK Go TESTS 47 234 7680000 1600
199522687 Yash9890 D March 28, 2023, 11:06 a.m. OK Java 11 TESTS 47 311 8089600 1600
199584137 rchauhan.ug20 D March 28, 2023, 7:21 p.m. OK Java 11 TESTS 47 342 6758400 1600
199513578 nonesl D March 28, 2023, 9:33 a.m. OK Java 11 TESTS 47 358 10035200 1600
199405605 ETHANHUNTMI5 D March 27, 2023, 12:25 p.m. OK Java 11 TESTS 47 389 11571200 1600
199525791 alibaba D March 28, 2023, 11:31 a.m. OK Java 11 TESTS 47 405 6860800 1600
199431341 bleach__ D March 27, 2023, 3:41 p.m. OK Java 11 TESTS 47 421 68403200 1600
199844022 dheerajchhatanidc D March 30, 2023, 3:01 p.m. OK Java 11 TESTS 47 514 9830400 1600
199514979 iamdimonis D March 28, 2023, 9:47 a.m. OK Java 11 TESTS 47 670 12595200 1600
199733568 the_half_blood_prince D March 29, 2023, 4:52 p.m. OK Java 11 TESTS 47 873 5324800 1600
199738603 shubham_409 D March 29, 2023, 5:37 p.m. OK Java 17 TESTS 47 374 26624000 1600
199455223 not_just_rr D March 27, 2023, 7:20 p.m. OK Java 17 TESTS 47 452 7168000 1600
199449031 Saurabh_jayaswal D March 27, 2023, 6:15 p.m. OK Java 17 TESTS 47 483 21299200 1600
199740699 Doni04 D March 29, 2023, 5:57 p.m. OK Java 17 TESTS 47 514 18636800 1600
199902693 xyz_000 D March 31, 2023, 3:42 a.m. OK Java 17 TESTS 47 546 32972800 1600
199792344 PizzaLovers007 D March 30, 2023, 7:20 a.m. OK Java 17 TESTS 47 623 20480000 1600
200026502 merlin_ D March 31, 2023, 5:28 p.m. OK Java 17 TESTS 47 982 34099200 1600
199543234 Varun_tec D March 28, 2023, 1:44 p.m. OK Java 17 TESTS 47 1154 9420800 1600
199445575 Yuh_03 D March 27, 2023, 5:42 p.m. OK Java 17 TESTS 47 1528 28364800 1600
199450426 Sahiladhikari11 D March 27, 2023, 6:29 p.m. OK Java 17 TESTS 47 1949 15257600 1600
199917020 yvbf D March 31, 2023, 7:27 a.m. OK Java 8 TESTS 47 202 0 1600
199585911 Kenzhezhan D March 28, 2023, 7:42 p.m. OK Java 8 TESTS 47 234 21094400 1600
199585611 Ziran3234 D March 28, 2023, 7:39 p.m. OK Java 8 TESTS 47 249 15155200 1600
199948072 1091857051 D March 31, 2023, 1:02 p.m. OK Java 8 TESTS 47 343 3891200 1600
199911283 oneafter D March 31, 2023, 6:12 a.m. OK Java 8 TESTS 47 358 13312000 1600
199420802 raj_shahh D March 27, 2023, 2:19 p.m. OK Java 8 TESTS 47 405 75571200 1600
199421528 tong96 D March 27, 2023, 2:24 p.m. OK Java 8 TESTS 47 514 18534400 1600
199927418 stolis D March 31, 2023, 9:34 a.m. OK Java 8 TESTS 47 623 18432000 1600
199418811 raj_shahh D March 27, 2023, 2:05 p.m. OK Java 8 TESTS 47 638 76083200 1600
199622965 WangRuiCong D March 29, 2023, 5:56 a.m. OK Java 8 TESTS 47 1668 16179200 1600
199687898 kuzAnatoliy D March 29, 2023, 11:05 a.m. OK JavaScript TESTS 47 654 57651200 1600
199571295 ishybee D March 28, 2023, 5:19 p.m. OK MS C++ 2017 TESTS 47 265 8499200 1600
199926763 cz1137 D March 31, 2023, 9:27 a.m. OK MS C++ 2017 TESTS 47 530 4608000 1600
199404949 aadrito D March 27, 2023, 12:19 p.m. OK MS C++ 2017 TESTS 47 546 7372800 1600
199502858 Vlasov211 D March 28, 2023, 7:37 a.m. OK MS C++ 2017 TESTS 47 701 4608000 1600
199422753 adesh123 D March 27, 2023, 2:33 p.m. OK MS C++ 2017 TESTS 47 811 5836800 1600
199570937 ishybee D March 28, 2023, 5:16 p.m. OK MS C++ 2017 TESTS 47 904 10444800 1600
199480399 chinesedfan D March 28, 2023, 2:04 a.m. OK Node.js TESTS 47 343 51200000 1600
199432592 satyajeetdas045 D March 27, 2023, 3:51 p.m. OK PyPy 2 TESTS 47 296 96972800 1600
199431568 rajeshpenugonda D March 27, 2023, 3:43 p.m. OK PyPy 3 TESTS 47 358 39526400 1600
199455429 Yash_Nandwana D March 27, 2023, 7:22 p.m. OK PyPy 3 TESTS 47 452 35942400 1600
199423665 pranay_28 D March 27, 2023, 2:40 p.m. OK PyPy 3 TESTS 47 951 28364800 1600
199493646 atLeastBlue D March 28, 2023, 5:51 a.m. OK PyPy 3 TESTS 47 1466 26726400 1600
199445366 lol_py D March 27, 2023, 5:41 p.m. OK PyPy 3 TESTS 47 1684 31334400 1600
199405181 5af D March 27, 2023, 12:21 p.m. OK PyPy 3 TESTS 47 1730 30310400 1600
199570684 ipip D March 28, 2023, 5:14 p.m. OK PyPy 3 TESTS 47 1731 31027200 1600
199481389 JUBHAI D March 28, 2023, 2:26 a.m. OK PyPy 3 TESTS 47 1762 28467200 1600
199471600 samchen123 D March 27, 2023, 10:38 p.m. OK PyPy 3-64 TESTS 47 233 45875200 1600
199637114 Mayank_Bad D March 29, 2023, 8:46 a.m. OK PyPy 3-64 TESTS 47 249 44134400 1600
199759765 isekun D March 29, 2023, 9:32 p.m. OK PyPy 3-64 TESTS 47 264 45875200 1600
199608757 Mars_FN D March 29, 2023, 1:58 a.m. OK PyPy 3-64 TESTS 47 280 48844800 1600
199546475 onemoreq D March 28, 2023, 2:08 p.m. OK PyPy 3-64 TESTS 47 280 51712000 1600
199514027 M_ElFatih D March 28, 2023, 9:37 a.m. OK PyPy 3-64 TESTS 47 295 44236800 1600
199422945 DP_FORMULA D March 27, 2023, 2:34 p.m. OK PyPy 3-64 TESTS 47 296 47616000 1600
199455198 mr_robot_96x D March 27, 2023, 7:19 p.m. OK PyPy 3-64 TESTS 47 311 44748800 1600
199399708 JinYuManTang D March 27, 2023, 11:33 a.m. OK PyPy 3-64 TESTS 47 311 44748800 1600
199411600 liuaaa D March 27, 2023, 1:12 p.m. OK PyPy 3-64 TESTS 47 327 48230400 1600
199581757 Parag_AP D March 28, 2023, 6:54 p.m. OK Python 3 TESTS 47 826 25190400 1600
199580677 Parag_AP D March 28, 2023, 6:41 p.m. OK Python 3 TESTS 47 826 25190400 1600
199931679 NS3081992 D March 31, 2023, 10:21 a.m. OK Python 3 TESTS 47 998 30720000 1600
199579824 billeh77 D March 28, 2023, 6:32 p.m. OK Python 3 TESTS 47 1029 22732800 1600
199454802 ayushkum D March 27, 2023, 7:15 p.m. OK Python 3 TESTS 47 1106 26214400 1600
199827389 FLY_lai D March 30, 2023, 1:13 p.m. OK Python 3 TESTS 47 1107 26214400 1600
199633029 zerow D March 29, 2023, 8:02 a.m. OK Python 3 TESTS 47 1107 26214400 1600
199562172 Harish_777 D March 28, 2023, 4:06 p.m. OK Python 3 TESTS 47 1107 26214400 1600
199527214 The_KOG D March 28, 2023, 11:42 a.m. OK Python 3 TESTS 47 1107 26214400 1600
199483810 2000030180 D March 28, 2023, 3:16 a.m. OK Python 3 TESTS 47 1107 26214400 1600
199416831 robostac D March 27, 2023, 1:51 p.m. OK Rust 2021 TESTS 47 186 36966400 1600

remove filters

Back to search problems