Codeforces Round 669 (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
1407 Codeforces Round 669 (Div. 2) FINISHED False 7200 137690663 Sept. 8, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 20597 ) A Ahahahahahahahaha PROGRAMMING constructive algorithms math

B"Alexandra has an even-length array a , consisting of 0 s and 1 s. The elements of the array are enumerated from 1 to n . She wants to remove at most frac{n}{2} elements (where n -- length of array) in the way that alternating sum of the array will be equal 0 (i.e. a_1 - a_2 + a_3 - a_4 + ... c = 0 ). In other words, Alexandra wants sum of all elements at the odd positions and sum of all elements at the even positions to become equal. The elements that you remove don't have to be consecutive. For example, if she has a = [1, 0, 1, 0, 0, 0] and she removes 2 nd and 4 th elements, a will become equal [1, 1, 0, 0] and its alternating sum is 1 - 1 + 0 - 0 = 0 . Help her! Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^3 ). Description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 10^3 , n is even) -- length of the array. The second line contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 1 ) -- elements of the array. It is guaranteed that the sum of n over all test cases does not exceed 10^3 . For each test case, firstly, print k ( frac{n}{2} <= q k <= q n ) -- number of elements that will remain after removing in the order they appear in a . Then, print this k numbers. Note that you should print the numbers themselves, not their indices. We can show that an answer always exists. If there are several answers, you can output any of them. In the first and second cases, alternating sum of the array, obviously, equals 0 . In the third case, alternating sum of the array equals 1 - 1 = 0 . In the fourth case, alternating sum already equals 1 - 1 + 0 - 0 = 0 , so we don't have to remove anything. "...

Tutorials

Codeforces Round #669 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
92283064 MSCReddy A Sept. 8, 2020, 4:33 p.m. OK GNU C11 TESTS 10 30 307200
92296815 raman0971 A Sept. 8, 2020, 6:53 p.m. OK GNU C11 TESTS 10 31 0
92319574 Anuj123321 A Sept. 9, 2020, 5:12 a.m. OK GNU C11 TESTS 10 31 0
92318158 VCode A Sept. 9, 2020, 4:46 a.m. OK GNU C++11 TESTS 10 15 0
92321837 ddgo A Sept. 9, 2020, 5:47 a.m. OK GNU C++11 TESTS 10 15 0
92317712 wbyyui A Sept. 9, 2020, 4:37 a.m. OK GNU C++11 TESTS 10 15 0
92317096 kpeaker A Sept. 9, 2020, 4:25 a.m. OK GNU C++11 TESTS 10 15 0
92322618 rafaielanam A Sept. 9, 2020, 5:59 a.m. OK GNU C++11 TESTS 10 15 0
92318510 Shana16 A Sept. 9, 2020, 4:53 a.m. OK GNU C++11 TESTS 10 15 0
92318317 Rae1 A Sept. 9, 2020, 4:49 a.m. OK GNU C++11 TESTS 10 15 0
92321198 Mr_black_devil A Sept. 9, 2020, 5:37 a.m. OK GNU C++11 TESTS 10 15 0
92320515 tsh A Sept. 9, 2020, 5:27 a.m. OK GNU C++11 TESTS 10 15 0
92320012 computerkiller A Sept. 9, 2020, 5:19 a.m. OK GNU C++11 TESTS 10 15 0
92312680 raman_111 A Sept. 9, 2020, 2:46 a.m. OK GNU C++14 TESTS 10 15 0
92312491 suhel_45 A Sept. 9, 2020, 2:41 a.m. OK GNU C++14 TESTS 10 15 0
92295519 _shiv_ A Sept. 8, 2020, 6:34 p.m. OK GNU C++14 TESTS 10 15 0
92293396 float_Sammy A Sept. 8, 2020, 6:07 p.m. OK GNU C++14 TESTS 10 15 0
92287721 akshu04 A Sept. 8, 2020, 5:13 p.m. OK GNU C++14 TESTS 10 15 0
92286288 naman471 A Sept. 8, 2020, 5:05 p.m. OK GNU C++14 TESTS 10 15 0
92283698 Tutul_dhar A Sept. 8, 2020, 4:34 p.m. OK GNU C++14 TESTS 10 15 0
92321860 Shreya.Deep.7 A Sept. 9, 2020, 5:47 a.m. OK GNU C++14 TESTS 10 15 0
92318935 omega_16 A Sept. 9, 2020, 5:01 a.m. OK GNU C++14 TESTS 10 15 0
92314107 Amanbhadauria01 A Sept. 9, 2020, 3:22 a.m. OK GNU C++14 TESTS 10 15 0
92310412 vikramthalla A Sept. 9, 2020, 1:35 a.m. OK GNU C++17 TESTS 10 15 0
92321091 rlmn A Sept. 9, 2020, 5:35 a.m. OK GNU C++17 TESTS 10 15 0
92318484 Momosama A Sept. 9, 2020, 4:52 a.m. OK GNU C++17 TESTS 10 15 0
92317389 Syins A Sept. 9, 2020, 4:31 a.m. OK GNU C++17 TESTS 10 15 0
92317064 Porandiginia A Sept. 9, 2020, 4:24 a.m. OK GNU C++17 TESTS 10 15 0
92316295 Eagle_042 A Sept. 9, 2020, 4:09 a.m. OK GNU C++17 TESTS 10 15 0
92314909 khoya_musafir A Sept. 9, 2020, 3:41 a.m. OK GNU C++17 TESTS 10 15 0
92314882 palax0 A Sept. 9, 2020, 3:40 a.m. OK GNU C++17 TESTS 10 15 0
92309815 imsadouo A Sept. 9, 2020, 1:12 a.m. OK GNU C++17 TESTS 10 15 0
92309694 dzgod1905 A Sept. 9, 2020, 1:08 a.m. OK GNU C++17 TESTS 10 15 0
92317435 Prakhar6969 A Sept. 9, 2020, 4:32 a.m. OK GNU C++17 (64) TESTS 10 15 0
92315117 gameofcodes A Sept. 9, 2020, 3:45 a.m. OK GNU C++17 (64) TESTS 10 15 0
92313763 sjm1512 A Sept. 9, 2020, 3:14 a.m. OK GNU C++17 (64) TESTS 10 15 0
92309515 ruz A Sept. 9, 2020, 1:01 a.m. OK GNU C++17 (64) TESTS 10 15 0
92309341 fugii A Sept. 9, 2020, 12:54 a.m. OK GNU C++17 (64) TESTS 10 15 0
92308773 sakibfahim1999 A Sept. 9, 2020, 12:28 a.m. OK GNU C++17 (64) TESTS 10 15 0
92304065 vmadhu99 A Sept. 8, 2020, 9:17 p.m. OK GNU C++17 (64) TESTS 10 15 0
92319017 ShivY08 A Sept. 9, 2020, 5:02 a.m. OK GNU C++17 (64) TESTS 10 15 0
92320862 shlokam A Sept. 9, 2020, 5:32 a.m. OK GNU C++17 (64) TESTS 10 15 0
92321924 daemonfeurer A Sept. 9, 2020, 5:48 a.m. OK GNU C++17 (64) TESTS 10 15 0
92313752 synapse A Sept. 9, 2020, 3:14 a.m. OK Go TESTS 10 31 0
92288194 jegfault A Sept. 8, 2020, 5:16 p.m. OK Haskell TESTS 10 31 102400
92296874 amit_chas A Sept. 8, 2020, 6:54 p.m. OK Java 11 TESTS 10 171 0
92319717 rafee69029 A Sept. 9, 2020, 5:15 a.m. OK Java 11 TESTS 10 171 0
92316328 tusharrr A Sept. 9, 2020, 4:10 a.m. OK Java 11 TESTS 10 171 0
92304856 skittles1412 A Sept. 8, 2020, 9:43 p.m. OK Java 11 TESTS 10 171 0
92302148 dmw A Sept. 8, 2020, 8:25 p.m. OK Java 11 TESTS 10 171 0
92295456 litesam A Sept. 8, 2020, 6:33 p.m. OK Java 11 TESTS 10 171 0
92291300 jayesh_patil A Sept. 8, 2020, 5:44 p.m. OK Java 11 TESTS 10 171 0
92285521 Lior A Sept. 8, 2020, 5:02 p.m. OK Java 11 TESTS 10 171 0
92316929 shrinidhi99 A Sept. 9, 2020, 4:21 a.m. OK Java 11 TESTS 10 186 0
92315316 jeeb0xical A Sept. 9, 2020, 3:49 a.m. OK Java 11 TESTS 10 186 0
92313354 revanthreddy85 A Sept. 9, 2020, 3:04 a.m. OK Java 8 TESTS 10 93 0
92292588 01naveenv A Sept. 8, 2020, 5:58 p.m. OK Java 8 TESTS 10 93 0
92322607 priyam_anand A Sept. 9, 2020, 5:59 a.m. OK Java 8 TESTS 10 108 0
92314665 sumitnitesh123 A Sept. 9, 2020, 3:35 a.m. OK Java 8 TESTS 10 108 0
92310573 shashwat07 A Sept. 9, 2020, 1:41 a.m. OK Java 8 TESTS 10 108 0
92296443 O-infinity A Sept. 8, 2020, 6:47 p.m. OK Java 8 TESTS 10 108 0
92293964 naitikvarshney77 A Sept. 8, 2020, 6:13 p.m. OK Java 8 TESTS 10 108 0
92293647 thebigjuicyd A Sept. 8, 2020, 6:10 p.m. OK Java 8 TESTS 10 108 0
92290231 Vaibhav_Domadia A Sept. 8, 2020, 5:33 p.m. OK Java 8 TESTS 10 108 0
92319224 sushant-kun A Sept. 9, 2020, 5:06 a.m. OK Java 8 TESTS 10 109 0
92302247 braher A Sept. 8, 2020, 8:28 p.m. OK Mono C# TESTS 10 62 1945600
92289652 hhsaffar A Sept. 8, 2020, 5:28 p.m. OK Mono C# TESTS 10 62 3788800
92288443 songjunwei A Sept. 8, 2020, 5:18 p.m. OK MS C++ 2017 TESTS 10 30 307200
92285663 ustaritz A Sept. 8, 2020, 5:03 p.m. OK MS C++ 2017 TESTS 10 31 0
92319087 greysheep A Sept. 9, 2020, 5:04 a.m. OK MS C++ 2017 TESTS 10 31 0
92305241 Borisk A Sept. 8, 2020, 9:55 p.m. OK MS C++ 2017 TESTS 10 31 307200
92295002 kgupta3199 A Sept. 8, 2020, 6:27 p.m. OK MS C++ 2017 TESTS 10 46 0
92296675 kit.shiron A Sept. 8, 2020, 6:51 p.m. OK PyPy 2 TESTS 10 93 0
92285551 iamprayush A Sept. 8, 2020, 5:02 p.m. OK PyPy 2 TESTS 10 249 9113600
92303679 AndySave A Sept. 8, 2020, 9:06 p.m. OK PyPy 3 TESTS 10 124 0
92290785 Cmndr_Salamander A Sept. 8, 2020, 5:39 p.m. OK PyPy 3 TESTS 10 124 0
92304832 kobratooth A Sept. 8, 2020, 9:42 p.m. OK PyPy 3 TESTS 10 124 1126400
92292409 evoxtorm A Sept. 8, 2020, 5:55 p.m. OK PyPy 3 TESTS 10 124 1331200
92301183 artkhl A Sept. 8, 2020, 8:06 p.m. OK PyPy 3 TESTS 10 124 1536000
92291423 yusinv A Sept. 8, 2020, 5:45 p.m. OK PyPy 3 TESTS 10 124 1536000
92314834 codershuvo A Sept. 9, 2020, 3:39 a.m. OK PyPy 3 TESTS 10 124 1638400
92285780 FahimSifnatul A Sept. 8, 2020, 5:03 p.m. OK PyPy 3 TESTS 10 139 0
92294601 Ranveer_007 A Sept. 8, 2020, 6:21 p.m. OK PyPy 3 TESTS 10 139 1536000
92321008 Nikhil1002 A Sept. 9, 2020, 5:34 a.m. OK PyPy 3 TESTS 10 139 1638400
92288504 nwi A Sept. 8, 2020, 5:19 p.m. OK Python 2 TESTS 10 202 0
92314846 mr_adi A Sept. 9, 2020, 3:39 a.m. OK Python 3 TESTS 10 93 0
92296651 yasirm A Sept. 8, 2020, 6:50 p.m. OK Python 3 TESTS 10 93 0
92314088 301_anky A Sept. 9, 2020, 3:21 a.m. OK Python 3 TESTS 10 93 204800
92317479 peftamid A Sept. 9, 2020, 4:33 a.m. OK Python 3 TESTS 10 93 307200
92317415 peftamid A Sept. 9, 2020, 4:32 a.m. OK Python 3 TESTS 10 93 307200
92317155 jaswantharyaa A Sept. 9, 2020, 4:26 a.m. OK Python 3 TESTS 10 93 307200
92316195 rohit_lohar A Sept. 9, 2020, 4:07 a.m. OK Python 3 TESTS 10 93 307200
92315976 kingutus A Sept. 9, 2020, 4:03 a.m. OK Python 3 TESTS 10 93 307200
92314501 sinthia.rupa71 A Sept. 9, 2020, 3:31 a.m. OK Python 3 TESTS 10 93 307200
92314243 stocke777 A Sept. 9, 2020, 3:25 a.m. OK Python 3 TESTS 10 93 307200
92297402 wow_ok A Sept. 8, 2020, 7:01 p.m. OK Ruby TESTS 10 498 716800
92297341 wow_ok A Sept. 8, 2020, 7:01 p.m. OK Ruby TESTS 10 499 102400
92289987 IvanDyachenko A Sept. 8, 2020, 5:31 p.m. OK Scala TESTS 10 436 0
92286158 IvanDyachenko A Sept. 8, 2020, 5:04 p.m. OK Scala TESTS 10 592 0

remove filters

Back to search problems