Codeforces Round 794 (Div. 1)

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
1685 Codeforces Round 794 (Div. 1) FINISHED False 8100 78323099 May 25, 2022, 5:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 17205 ) A Circular Local MiniMax PROGRAMMING constructive algorithms greedy sortings 1100

B"You are given n integers a_1, a_2, ldots, a_n . Is it possible to arrange them on a circle so that each number is strictly greater than both its neighbors or strictly smaller than both its neighbors? In other words, check if there exists a rearrangement b_1, b_2, ldots, b_n of the integers a_1, a_2, ldots, a_n such that for each i from 1 to n at least one of the following conditions holds: To make sense of the previous formulas for i=1 and i=n , one shall define b_0=b_n and b_{n+1}=b_1 . The first line of the input contains a single integer t ( 1 <= t <= 3 cdot 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 3 <= n <= 10^5 ) -- the number of integers. The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 10^9 ). The sum of n over all test cases doesn't exceed 2 cdot 10^5 . For each test case, if it is not possible to arrange the numbers on the circle satisfying the conditions from the statement, output texttt{NO} . You can output each letter in any case. Otherwise, output texttt{YES} . In the second line, output n integers b_1, b_2, ldots, b_n , which are a rearrangement of a_1, a_2, ldots, a_n and satisfy the conditions from the statement. If there are multiple valid ways to arrange the numbers, you can output any of them. It can be shown that there are no valid arrangements for the first and the third test cases. In the second test case, the arrangement [1, 8, 4, 9] works. In this arrangement, 1 and 4 are both smaller than their neighbors, and 8, 9 are larger. In the fourth test case, the arrangement [1, 11, 1, 111, 1, 1111] works. In this arrangement, the three elements equal to 1 are smaller than their neighbors, while all other element"...

Tutorials

103198

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
158422375 mban259 A May 25, 2022, 5:46 p.m. OK C# 10 TESTS 16 124 30924800 1100
158421444 Gassa A May 25, 2022, 5:45 p.m. OK D TESTS 16 109 13516800 1100
158417760 hos.lyric A May 25, 2022, 5:41 p.m. OK D TESTS 16 156 13516800 1100
158436996 chro4896 A May 25, 2022, 6:09 p.m. OK GNU C11 TESTS 16 873 819200 1100
158521530 fengqiyuka A May 26, 2022, 11:36 a.m. OK GNU C++14 TESTS 16 78 409600 1100
158480066 peiwenjun A May 26, 2022, 1:02 a.m. OK GNU C++14 TESTS 16 78 409600 1100
158515624 sweetyyy A May 26, 2022, 10:29 a.m. OK GNU C++14 TESTS 16 78 819200 1100
158559831 Elon_chacha_hai_hmre A May 26, 2022, 6:52 p.m. OK GNU C++14 TESTS 16 93 512000 1100
158478915 lin7xu A May 26, 2022, 12:22 a.m. OK GNU C++14 TESTS 16 93 716800 1100
158563203 Mrinall A May 26, 2022, 7:48 p.m. OK GNU C++14 TESTS 16 93 819200 1100
158520812 Phantasy A May 26, 2022, 11:28 a.m. OK GNU C++14 TESTS 16 93 819200 1100
158505103 S.SH A May 26, 2022, 8:14 a.m. OK GNU C++14 TESTS 16 93 819200 1100
158499049 Shayan.P Kalam Atreus A May 26, 2022, 6:55 a.m. OK GNU C++14 TESTS 16 93 819200 1100
158573140 Suiseiseki A May 27, 2022, 1:33 a.m. OK GNU C++14 TESTS 16 93 819200 1100
158415768 iaNTU A May 25, 2022, 5:39 p.m. OK GNU C++17 TESTS 16 62 921600 1100
158482675 Fairy_Tale A May 26, 2022, 2:21 a.m. OK GNU C++17 TESTS 16 92 1126400 1100
158424212 MohammadAghil A May 25, 2022, 5:49 p.m. OK GNU C++17 TESTS 16 93 512000 1100
158421674 paula A May 25, 2022, 5:46 p.m. OK GNU C++17 TESTS 16 93 512000 1100
158432454 Alon-Tanay A May 25, 2022, 6:01 p.m. OK GNU C++17 TESTS 16 93 512000 1100
158484968 xhlong A May 26, 2022, 3:12 a.m. OK GNU C++17 TESTS 16 93 819200 1100
158471085 DRSR_4919 A May 25, 2022, 8:35 p.m. OK GNU C++17 TESTS 16 93 819200 1100
158458832 lxhgww A May 25, 2022, 7:10 p.m. OK GNU C++17 TESTS 16 93 819200 1100
158435129 Wailydest A May 25, 2022, 6:05 p.m. OK GNU C++17 TESTS 16 93 819200 1100
158489870 ParsaAp A May 26, 2022, 4:46 a.m. OK GNU C++17 TESTS 16 93 819200 1100
158535314 Renaxis A May 26, 2022, 2:03 p.m. OK GNU C++17 (64) TESTS 16 62 921600 1100
158522946 _Yeager_ A May 26, 2022, 11:51 a.m. OK GNU C++17 (64) TESTS 16 62 921600 1100
158418105 potato167 A May 25, 2022, 5:42 p.m. OK GNU C++17 (64) TESTS 16 62 921600 1100
158416415 KKT_89 A May 25, 2022, 5:40 p.m. OK GNU C++17 (64) TESTS 16 62 921600 1100
158559419 Ghassane A May 26, 2022, 6:46 p.m. OK GNU C++17 (64) TESTS 16 62 1638400 1100
158415708 ritul_kr_singh A May 25, 2022, 5:39 p.m. OK GNU C++17 (64) TESTS 16 62 1638400 1100
158417111 anpoli99 A May 25, 2022, 5:41 p.m. OK GNU C++17 (64) TESTS 16 62 2457600 1100
158435625 Komeiji_Green A May 25, 2022, 6:06 p.m. OK GNU C++17 (64) TESTS 16 62 3174400 1100
158418884 codr0 A May 25, 2022, 5:43 p.m. OK GNU C++17 (64) TESTS 16 77 409600 1100
158419418 wtf0501 A May 25, 2022, 5:43 p.m. OK GNU C++17 (64) TESTS 16 77 512000 1100
158418053 Sakuyalove A May 25, 2022, 5:42 p.m. OK GNU C++20 (64) TESTS 16 31 5529600 1100
158531821 p.ferrari A May 26, 2022, 1:26 p.m. OK GNU C++20 (64) TESTS 16 46 409600 1100
158419825 ItayOtto A May 25, 2022, 5:44 p.m. OK GNU C++20 (64) TESTS 16 46 512000 1100
158577016 Me_Tal A May 27, 2022, 3:29 a.m. OK GNU C++20 (64) TESTS 16 46 512000 1100
158453582 Qwerty1232 A May 25, 2022, 6:51 p.m. OK GNU C++20 (64) TESTS 16 46 512000 1100
158418490 Sorting A May 25, 2022, 5:42 p.m. OK GNU C++20 (64) TESTS 16 46 512000 1100
158498273 don2001 A May 26, 2022, 6:45 a.m. OK GNU C++20 (64) TESTS 16 46 716800 1100
158561050 AbduSaber A May 26, 2022, 7:12 p.m. OK GNU C++20 (64) TESTS 16 46 819200 1100
158500013 SanguineChameleon A May 26, 2022, 7:07 a.m. OK GNU C++20 (64) TESTS 16 46 819200 1100
158565258 Shakil.BD A May 26, 2022, 8:36 p.m. OK GNU C++20 (64) TESTS 16 46 819200 1100
158487971 jiomart A May 26, 2022, 4:11 a.m. OK Java 11 TESTS 16 218 0 1100
158429588 insert_cool_handle A May 25, 2022, 5:56 p.m. OK Java 11 TESTS 16 248 0 1100
158571564 PikaChu999 A May 27, 2022, 12:24 a.m. OK Java 11 TESTS 16 311 102400 1100
158553739 Kaldaruly A May 26, 2022, 5:29 p.m. OK Java 11 TESTS 16 592 204800 1100
158469301 YunoXTheo A May 25, 2022, 8:16 p.m. OK Java 11 TESTS 16 872 102400 1100
158441983 AndreySiunov A May 25, 2022, 6:19 p.m. OK Java 8 TESTS 16 202 0 1100
158420298 jxin31415 A May 25, 2022, 5:44 p.m. OK Java 8 TESTS 16 202 0 1100
158421415 SecondThread A May 25, 2022, 5:45 p.m. OK Java 8 TESTS 16 202 38502400 1100
158449746 WhatIsLove A May 25, 2022, 6:39 p.m. OK Java 8 TESTS 16 218 0 1100
158416378 MagentaCobra A May 25, 2022, 5:40 p.m. OK Java 8 TESTS 16 218 4300800 1100
158475986 abhayrajnegi0416 A May 25, 2022, 10:24 p.m. OK Java 8 TESTS 16 998 0 1100
158421507 Hakiobo A May 25, 2022, 5:45 p.m. OK Kotlin 1.4 TESTS 16 264 1126400 1100
158544654 Flame239 A May 26, 2022, 3:36 p.m. OK Kotlin 1.4 TESTS 16 467 7577600 1100
158418091 elizarov A May 25, 2022, 5:42 p.m. OK Kotlin 1.6 TESTS 16 514 9728000 1100
158577635 aslamhossin A May 27, 2022, 3:48 a.m. OK Kotlin 1.6 TESTS 16 733 2764800 1100
158421764 machine_solution A May 25, 2022, 5:46 p.m. OK MS C++ 2017 TESTS 16 280 3686400 1100
158555659 swapnilsingh421 A May 26, 2022, 5:53 p.m. OK PyPy 2 TESTS 16 202 14950400 1100
158514475 ruimina A May 26, 2022, 10:14 a.m. OK PyPy 3 TESTS 16 249 17612800 1100
158418564 misorin A May 25, 2022, 5:42 p.m. OK PyPy 3 TESTS 16 327 23654400 1100
158416526 hxu10 A May 25, 2022, 5:40 p.m. OK PyPy 3 TESTS 16 373 17100800 1100
158418869 titia A May 25, 2022, 5:43 p.m. OK PyPy 3 TESTS 16 499 14540800 1100
158422264 whatshisbucket A May 25, 2022, 5:46 p.m. OK PyPy 3 TESTS 16 514 14950400 1100
158430461 tcltk A May 25, 2022, 5:57 p.m. OK PyPy 3 TESTS 16 560 17408000 1100
158417088 SPD_9X2 A May 25, 2022, 5:41 p.m. OK PyPy 3 TESTS 16 576 29491200 1100
158562030 Milok A May 26, 2022, 7:26 p.m. OK PyPy 3 TESTS 16 841 14438400 1100
158501760 Sufiyan18 A May 26, 2022, 7:31 a.m. OK PyPy 3 TESTS 16 841 15155200 1100
158577705 you_cant_see_me A May 27, 2022, 3:50 a.m. OK PyPy 3 TESTS 16 982 17920000 1100
158427048 shobonvip A May 25, 2022, 5:52 p.m. OK PyPy 3-64 TESTS 16 233 27750400 1100
158418021 plevande A May 25, 2022, 5:42 p.m. OK PyPy 3-64 TESTS 16 280 22630400 1100
158477064 samchen123 A May 25, 2022, 11:02 p.m. OK PyPy 3-64 TESTS 16 358 22016000 1100
158415916 conqueror_of_tourist A May 25, 2022, 5:39 p.m. OK PyPy 3-64 TESTS 16 374 26214400 1100
158552698 nickk2002 A May 26, 2022, 5:16 p.m. OK PyPy 3-64 TESTS 16 389 20992000 1100
158552847 nickk2002 A May 26, 2022, 5:18 p.m. OK PyPy 3-64 TESTS 16 405 20684800 1100
158478244 siganai A May 25, 2022, 11:53 p.m. OK PyPy 3-64 TESTS 16 420 22630400 1100
158486559 shiviDON A May 26, 2022, 3:43 a.m. OK PyPy 3-64 TESTS 16 468 26112000 1100
158552921 nickk2002 A May 26, 2022, 5:19 p.m. OK PyPy 3-64 TESTS 16 483 21504000 1100
158520516 asdsasd A May 26, 2022, 11:25 a.m. OK PyPy 3-64 TESTS 16 499 22528000 1100
158426948 Jimanbanashi A May 25, 2022, 5:52 p.m. OK Python 2 TESTS 16 249 8294400 1100
158426780 r57shell A May 25, 2022, 5:52 p.m. OK Python 3 TESTS 16 280 9523200 1100
158494208 nasablackberry A May 26, 2022, 5:54 a.m. OK Python 3 TESTS 16 451 10649600 1100
158474070 Youmar24 A May 25, 2022, 9:31 p.m. OK Python 3 TESTS 16 452 11366400 1100
158487349 aravind21 A May 26, 2022, 3:59 a.m. OK Python 3 TESTS 16 514 10956800 1100
158542771 jiang4869 A May 26, 2022, 3:15 p.m. OK Python 3 TESTS 16 514 11264000 1100
158564470 non0stop A May 26, 2022, 8:18 p.m. OK Python 3 TESTS 16 576 10547200 1100
158478436 nkcrg060497 A May 26, 2022, 12:02 a.m. OK Python 3 TESTS 16 577 10649600 1100
158535243 Itsshubham07 A May 26, 2022, 2:02 p.m. OK Python 3 TESTS 16 888 10035200 1100
158488330 Shinonome_Ena A May 26, 2022, 4:18 a.m. OK Rust 2021 TESTS 16 31 3584000 1100
158574024 Spheniscine A May 27, 2022, 2 a.m. OK Rust 2021 TESTS 16 62 3276800 1100
158432443 Russell_Emerine A May 25, 2022, 6:01 p.m. OK Rust 2021 TESTS 16 77 11776000 1100
158418099 qwerty787788 A May 25, 2022, 5:42 p.m. OK Rust 2021 TESTS 16 78 1126400 1100

remove filters

Back to search problems