Codeforces Round 618 (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
1300 Codeforces Round 618 (Div. 2) FINISHED False 7200 150566099 Feb. 9, 2020, 2:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 21072 ) A Non-zero PROGRAMMING implementation math 700

B"Guy-Manuel and Thomas have an array a of n integers [ a_1, a_2, ... , a_n ]. In one step they can add 1 to any element of the array. Formally, in one step they can choose any integer index i ( 1 <= i <= n ) and do a_i := a_i + 1 . If either the sum or the product of all elements in the array is equal to zero, Guy-Manuel and Thomas do not mind to do this operation one more time. What is the minimum number of steps they need to do to make both the sum and the product of all elements in the array different from zero? Formally, find the minimum number of steps to make a_1 + a_2 + ... + a_n ne 0 and a_1 cdot a_2 cdot ... cdot a_n ne 0 . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^3 ). The description of the test cases follows. The first line of each test case contains an integer n ( 1 <= n <= 100 ) -- the size of the array. The second line of each test case contains n integers a_1, a_2, ... , a_n ( -100 <= a_i <= 100 ) -- elements of the array . For each test case, output the minimum number of steps required to make both sum and product of all elements in the array different from zero. In the first test case, the sum is 0 . If we add 1 to the first element, the array will be [3,-1,-1] , the sum will be equal to 1 and the product will be equal to 3 . In the second test case, both product and sum are 0 . If we add 1 to the second and the third element, the array will be [-1,1,1,1] , the sum will be equal to 2 and the product will be equal to -1 . It can be shown that fewer steps can't be enough. In the third test case, both sum and product are non-zero, we don't need to do anything. In the fourth test case, after adding 1 twice to the first element the array will be [2,-2,1] , the sum will be 1 and the "...

Tutorials

Codeforces Round #618 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
70706866 541907010414 A Feb. 10, 2020, 5:35 a.m. OK Clang++17 Diagnostics TESTS 27 343 0 700
70753489 Gurpreet_1 A Feb. 10, 2020, 7:57 p.m. OK Clang++17 Diagnostics TESTS 27 373 1024000 700
70823129 vivekkumar1614 A Feb. 12, 2020, 5:05 a.m. OK Clang++17 Diagnostics TESTS 27 374 4198400 700
70705147 OtherPhantasy A Feb. 10, 2020, 4:53 a.m. OK FPC TESTS 27 31 307200 700
71093745 vjudge2 A Feb. 15, 2020, 3:34 a.m. OK FPC TESTS 27 46 0 700
70645312 VHTung A Feb. 9, 2020, 2:31 p.m. OK FPC TESTS 27 46 307200 700
70652590 alexei_pc A Feb. 9, 2020, 2:46 p.m. OK FPC TESTS 27 46 307200 700
70775825 vjudge4 A Feb. 11, 2020, 8:51 a.m. OK GNU C11 TESTS 27 31 0 700
70730099 BugLeave A Feb. 10, 2020, 1:02 p.m. OK GNU C11 TESTS 27 31 0 700
70716568 Gauravp1941 A Feb. 10, 2020, 8:44 a.m. OK GNU C11 TESTS 27 31 0 700
70953368 hrridoyv2 A Feb. 13, 2020, 12:04 p.m. OK GNU C11 TESTS 27 31 0 700
71087782 swapme A Feb. 14, 2020, 10:29 p.m. OK GNU C11 TESTS 27 31 0 700
70918615 dammakoumayma72 A Feb. 12, 2020, 8:53 p.m. OK GNU C11 TESTS 27 31 0 700
70798147 resurrection_zero A Feb. 11, 2020, 4:08 p.m. OK GNU C11 TESTS 27 31 0 700
70842814 blind123 A Feb. 12, 2020, 12:34 p.m. OK GNU C11 TESTS 27 31 0 700
70843117 Ph0enX A Feb. 12, 2020, 12:40 p.m. OK GNU C11 TESTS 27 31 0 700
70784343 k_ayushh A Feb. 11, 2020, 11:50 a.m. OK GNU C11 TESTS 27 31 0 700
70696976 feibilun A Feb. 9, 2020, 11:36 p.m. OK GNU C++11 TESTS 27 30 0 700
70669939 NaNaNaNaN A Feb. 9, 2020, 3:36 p.m. OK GNU C++11 TESTS 27 30 0 700
70825520 Taday A Feb. 12, 2020, 6:13 a.m. OK GNU C++11 TESTS 27 30 0 700
70718195 xiaoxiaomo A Feb. 10, 2020, 9:15 a.m. OK GNU C++11 TESTS 27 30 0 700
70644279 nantfaker A Feb. 9, 2020, 2:29 p.m. OK GNU C++11 TESTS 27 30 3276800 700
71090573 rqbqbqb A Feb. 15, 2020, 1:12 a.m. OK GNU C++11 TESTS 27 31 0 700
71093758 vjudge5 A Feb. 15, 2020, 3:35 a.m. OK GNU C++11 TESTS 27 31 0 700
71094855 Sneakoscope A Feb. 15, 2020, 4:18 a.m. OK GNU C++11 TESTS 27 31 0 700
71045030 henry-tb A Feb. 14, 2020, 8:10 a.m. OK GNU C++11 TESTS 27 31 0 700
71066206 Vanishment A Feb. 14, 2020, 2:37 p.m. OK GNU C++11 TESTS 27 31 0 700
71048337 hnust_zhouyuxin1 A Feb. 14, 2020, 9:09 a.m. OK GNU C++14 TESTS 27 31 0 700
71096701 Sami121 A Feb. 15, 2020, 5:13 a.m. OK GNU C++14 TESTS 27 31 0 700
71044618 AsilenceBTF A Feb. 14, 2020, 8:02 a.m. OK GNU C++14 TESTS 27 31 0 700
70927190 wHO_AMI2_JUDGe A Feb. 13, 2020, 3:13 a.m. OK GNU C++14 TESTS 27 31 0 700
70943613 ModyFekry A Feb. 13, 2020, 9:08 a.m. OK GNU C++14 TESTS 27 31 0 700
70902734 Ahmad_Zaki A Feb. 12, 2020, 4:42 p.m. OK GNU C++14 TESTS 27 31 0 700
70827256 aman36 A Feb. 12, 2020, 6:55 a.m. OK GNU C++14 TESTS 27 31 0 700
70802946 number007 A Feb. 11, 2020, 5:30 p.m. OK GNU C++14 TESTS 27 31 0 700
70778745 glib A Feb. 11, 2020, 9:51 a.m. OK GNU C++14 TESTS 27 31 0 700
70775074 lztnb A Feb. 11, 2020, 8:35 a.m. OK GNU C++14 TESTS 27 31 0 700
70926810 vjudge4 A Feb. 13, 2020, 3 a.m. OK GNU C++17 TESTS 27 31 0 700
71023912 jonatas57 A Feb. 13, 2020, 9:57 p.m. OK GNU C++17 TESTS 27 31 0 700
70948614 tutmir A Feb. 13, 2020, 10:32 a.m. OK GNU C++17 TESTS 27 31 0 700
70926630 vjudge5 A Feb. 13, 2020, 2:54 a.m. OK GNU C++17 TESTS 27 31 0 700
70919880 Awsaf_BRUR11 A Feb. 12, 2020, 9:33 p.m. OK GNU C++17 TESTS 27 31 0 700
70915525 Vojin A Feb. 12, 2020, 7:40 p.m. OK GNU C++17 TESTS 27 31 0 700
70822495 chshsaber A Feb. 12, 2020, 4:43 a.m. OK GNU C++17 TESTS 27 31 0 700
70821088 StupidBrain A Feb. 12, 2020, 3:52 a.m. OK GNU C++17 TESTS 27 31 0 700
70815807 Rahul_Mala007 A Feb. 11, 2020, 11:23 p.m. OK GNU C++17 TESTS 27 31 0 700
70790635 8140898 A Feb. 11, 2020, 1:57 p.m. OK GNU C++17 TESTS 27 31 0 700
70643240 naipia A Feb. 9, 2020, 2:27 p.m. OK Go TESTS 27 46 0 700
70720787 fc-lib-xyz A Feb. 10, 2020, 10:08 a.m. OK Go TESTS 27 77 0 700
70703927 Russell_Emerine A Feb. 10, 2020, 4:15 a.m. OK Haskell TESTS 27 186 102400 700
70696790 Leewings A Feb. 9, 2020, 11:23 p.m. OK Java 11 TESTS 27 187 0 700
70694909 shallotwang129 A Feb. 9, 2020, 9:50 p.m. OK Java 11 TESTS 27 187 0 700
71071560 GiantTornado A Feb. 14, 2020, 4:02 p.m. OK Java 11 TESTS 27 202 0 700
70783117 Anonymous A Feb. 11, 2020, 11:25 a.m. OK Java 11 TESTS 27 202 0 700
70721314 kiberKotleta2009 A Feb. 10, 2020, 10:18 a.m. OK Java 11 TESTS 27 202 0 700
70692233 sarthak.0702 A Feb. 9, 2020, 8:17 p.m. OK Java 11 TESTS 27 202 0 700
70673461 potatmen A Feb. 9, 2020, 3:47 p.m. OK Java 11 TESTS 27 202 0 700
70648899 Adabala_chandu41 A Feb. 9, 2020, 2:38 p.m. OK Java 11 TESTS 27 217 0 700
70708345 soumitri12 A Feb. 10, 2020, 6:06 a.m. OK Java 11 TESTS 27 218 0 700
70694196 Chuchi787 A Feb. 9, 2020, 9:20 p.m. OK Java 11 TESTS 27 218 0 700
70808997 xodiac A Feb. 11, 2020, 7:33 p.m. OK Java 8 TESTS 27 109 0 700
71018205 Ad-007 A Feb. 13, 2020, 7:19 p.m. OK Java 8 TESTS 27 124 0 700
70936698 bwang1008 A Feb. 13, 2020, 6:58 a.m. OK Java 8 TESTS 27 124 0 700
70928630 Ajudiya_13 A Feb. 13, 2020, 3:59 a.m. OK Java 8 TESTS 27 124 0 700
70900845 mikhaylov_boris A Feb. 12, 2020, 4:32 p.m. OK Java 8 TESTS 27 124 0 700
70840977 kusomushi A Feb. 12, 2020, 11:58 a.m. OK Java 8 TESTS 27 124 0 700
70829189 Mann_27__ A Feb. 12, 2020, 7:43 a.m. OK Java 8 TESTS 27 124 0 700
70796675 musaab A Feb. 11, 2020, 3:42 p.m. OK Java 8 TESTS 27 124 0 700
70757913 bluesky111 A Feb. 10, 2020, 10:23 p.m. OK Java 8 TESTS 27 124 0 700
70756866 ndaidemf A Feb. 10, 2020, 9:37 p.m. OK Java 8 TESTS 27 124 0 700
70817279 pseudonimoX A Feb. 12, 2020, 12:59 a.m. OK JavaScript TESTS 27 46 1228800 700
70817030 pseudonimoX A Feb. 12, 2020, 12:44 a.m. OK JavaScript TESTS 27 46 1228800 700
70816956 pseudonimoX A Feb. 12, 2020, 12:39 a.m. OK JavaScript TESTS 27 46 1228800 700
70816103 pseudonimoX A Feb. 11, 2020, 11:40 p.m. OK JavaScript TESTS 27 46 1331200 700
70815761 pseudonimoX A Feb. 11, 2020, 11:20 p.m. OK JavaScript TESTS 27 46 1331200 700
70816203 pseudonimoX A Feb. 11, 2020, 11:46 p.m. OK JavaScript TESTS 27 61 1331200 700
70780258 walborn A Feb. 11, 2020, 10:24 a.m. OK JavaScript TESTS 27 62 1536000 700
70681996 formalist A Feb. 9, 2020, 5:14 p.m. OK Kotlin TESTS 27 139 0 700
70701049 Spheniscine A Feb. 10, 2020, 2:42 a.m. OK Kotlin TESTS 27 155 512000 700
70777512 SlavaG A Feb. 11, 2020, 9:25 a.m. OK Kotlin TESTS 27 171 512000 700
70652981 agent-10 A Feb. 9, 2020, 2:47 p.m. OK Kotlin TESTS 27 202 204800 700
70685498 sanyacoder A Feb. 9, 2020, 6:01 p.m. OK Kotlin TESTS 27 202 204800 700
70702799 KanhuKeNanu A Feb. 10, 2020, 3:40 a.m. OK Kotlin TESTS 27 202 204800 700
70729264 david_varela A Feb. 10, 2020, 12:49 p.m. OK Kotlin TESTS 27 202 1228800 700
70758695 Black_Fregat A Feb. 10, 2020, 11:05 p.m. OK Kotlin TESTS 27 217 204800 700
70780173 KanhuKeNanu A Feb. 11, 2020, 10:22 a.m. OK Kotlin TESTS 27 218 204800 700
70651903 ckarthickit A Feb. 9, 2020, 2:45 p.m. OK Kotlin TESTS 27 280 0 700
70662673 AsadulloProgrammist A Feb. 9, 2020, 3:13 p.m. OK Mono C# TESTS 27 62 3072000 700
70711796 liomvse A Feb. 10, 2020, 7:13 a.m. OK Mono C# TESTS 27 77 3072000 700
70667501 Ruban_Denic A Feb. 9, 2020, 3:28 p.m. OK Mono C# TESTS 27 77 3072000 700
70650810 1champ10n A Feb. 9, 2020, 2:42 p.m. OK Mono C# TESTS 27 77 3072000 700
70839010 fr0st A Feb. 12, 2020, 11:16 a.m. OK Mono C# TESTS 27 77 6758400 700
70649858 plasma-effect A Feb. 9, 2020, 2:40 p.m. OK Mono C# TESTS 27 77 6758400 700
70643747 bauorazov A Feb. 9, 2020, 2:28 p.m. OK Mono C# TESTS 27 78 3072000 700
70815452 mytas A Feb. 11, 2020, 11:01 p.m. OK Mono C# TESTS 27 78 6758400 700
70683926 TRR A Feb. 9, 2020, 5:37 p.m. OK Mono C# TESTS 27 92 3072000 700
70671460 geronimo00 A Feb. 9, 2020, 3:41 p.m. OK Mono C# TESTS 27 93 6758400 700
70785395 sdibt4 A Feb. 11, 2020, 12:10 p.m. OK MS C++ TESTS 27 31 0 700
70785061 sdibt5 A Feb. 11, 2020, 12:04 p.m. OK MS C++ TESTS 27 31 0 700
70784741 sdibt1 A Feb. 11, 2020, 11:58 a.m. OK MS C++ TESTS 27 31 0 700
70784555 sdibt3 A Feb. 11, 2020, 11:55 a.m. OK MS C++ TESTS 27 31 0 700
70784378 sdibt5 A Feb. 11, 2020, 11:51 a.m. OK MS C++ TESTS 27 31 0 700
70784191 sdibt3 A Feb. 11, 2020, 11:47 a.m. OK MS C++ TESTS 27 31 0 700
70784138 sdibt2 A Feb. 11, 2020, 11:46 a.m. OK MS C++ TESTS 27 31 0 700
70783042 sdibt3 A Feb. 11, 2020, 11:24 a.m. OK MS C++ TESTS 27 31 0 700
70707052 x_y A Feb. 10, 2020, 5:39 a.m. OK MS C++ TESTS 27 31 0 700
70786419 sdibt5 A Feb. 11, 2020, 12:30 p.m. OK MS C++ TESTS 27 46 0 700
70646072 ETOleading_official A Feb. 9, 2020, 2:32 p.m. OK MS C++ 2017 TESTS 27 46 0 700
70652797 foxdream A Feb. 9, 2020, 2:47 p.m. OK MS C++ 2017 TESTS 27 46 0 700
70658998 gaffwc A Feb. 9, 2020, 3:02 p.m. OK MS C++ 2017 TESTS 27 46 0 700
70710799 zust-isabella A Feb. 10, 2020, 6:52 a.m. OK MS C++ 2017 TESTS 27 46 0 700
70782763 sdibt2 A Feb. 11, 2020, 11:18 a.m. OK MS C++ 2017 TESTS 27 46 0 700
70825710 hnust_yexueqi A Feb. 12, 2020, 6:17 a.m. OK MS C++ 2017 TESTS 27 46 0 700
70826024 hnust_yexueqi A Feb. 12, 2020, 6:25 a.m. OK MS C++ 2017 TESTS 27 46 0 700
71009544 YinChuanSheng A Feb. 13, 2020, 5:12 p.m. OK MS C++ 2017 TESTS 27 46 0 700
70692146 Arif19 A Feb. 9, 2020, 8:15 p.m. OK MS C++ 2017 TESTS 27 46 3993600 700
70673719 Veeee9 A Feb. 9, 2020, 3:48 p.m. OK MS C++ 2017 TESTS 27 61 0 700
70646189 enivek A Feb. 9, 2020, 2:33 p.m. OK Node.js TESTS 27 202 4608000 700
70649225 klond90 A Feb. 9, 2020, 2:39 p.m. OK Node.js TESTS 27 202 4915200 700
70789414 Nidavellir A Feb. 11, 2020, 1:20 p.m. OK PascalABC.NET TESTS 27 373 102400 700
70788730 NoAnguish A Feb. 11, 2020, 1:07 p.m. OK PascalABC.NET TESTS 27 374 0 700
70655222 Neon73 A Feb. 9, 2020, 2:53 p.m. OK PascalABC.NET TESTS 27 389 102400 700
70805512 avres A Feb. 11, 2020, 6:18 p.m. OK PHP TESTS 27 46 409600 700
70653017 Kiral55 A Feb. 9, 2020, 2:47 p.m. OK PHP TESTS 27 46 409600 700
70689707 mayakin A Feb. 9, 2020, 7:18 p.m. OK PHP TESTS 27 61 409600 700
70808590 ann_ko A Feb. 11, 2020, 7:24 p.m. OK PHP TESTS 27 187 512000 700
70654141 sharon.wang1994 A Feb. 9, 2020, 2:50 p.m. OK PyPy 2 TESTS 27 218 1945600 700
70799536 suchet A Feb. 11, 2020, 4:30 p.m. OK PyPy 3 TESTS 27 171 3584000 700
71034384 answertalker920 A Feb. 14, 2020, 4:50 a.m. OK PyPy 3 TESTS 27 171 3686400 700
70808860 Affe A Feb. 11, 2020, 7:30 p.m. OK PyPy 3 TESTS 27 187 2969600 700
70649603 forever_Happiness A Feb. 9, 2020, 2:40 p.m. OK PyPy 3 TESTS 27 187 3379200 700
70748186 apoorvwatsky A Feb. 10, 2020, 6:02 p.m. OK PyPy 3 TESTS 27 202 2764800 700
70690025 thekushalghosh A Feb. 9, 2020, 7:24 p.m. OK PyPy 3 TESTS 27 202 3174400 700
70702084 pye A Feb. 10, 2020, 3:18 a.m. OK PyPy 3 TESTS 27 202 3276800 700
70649088 FlakeLCR A Feb. 9, 2020, 2:38 p.m. OK PyPy 3 TESTS 27 202 3379200 700
70808838 Affe A Feb. 11, 2020, 7:29 p.m. OK PyPy 3 TESTS 27 202 3481600 700
71059781 KirKhal A Feb. 14, 2020, 1:07 p.m. OK PyPy 3 TESTS 27 218 3276800 700
70693812 elistark A Feb. 9, 2020, 9:06 p.m. OK Python 2 TESTS 27 218 0 700
70644117 Mike10 A Feb. 9, 2020, 2:29 p.m. OK Python 2 TESTS 27 218 102400 700
71072690 bsr011 A Feb. 14, 2020, 4:23 p.m. OK Python 2 TESTS 27 233 102400 700
70813553 alex256gordon A Feb. 11, 2020, 9:37 p.m. OK Python 2 TESTS 27 264 0 700
70785583 honyacho A Feb. 11, 2020, 12:14 p.m. OK Python 3 TESTS 27 124 0 700
70740055 mmhaxor A Feb. 10, 2020, 3:43 p.m. OK Python 3 TESTS 27 124 0 700
70713249 pranayraycha A Feb. 10, 2020, 7:41 a.m. OK Python 3 TESTS 27 124 0 700
70697256 _4C3_ A Feb. 9, 2020, 11:57 p.m. OK Python 3 TESTS 27 124 0 700
70659593 vaman609 A Feb. 9, 2020, 3:04 p.m. OK Python 3 TESTS 27 124 0 700
71072771 poornapragnamath A Feb. 14, 2020, 4:25 p.m. OK Python 3 TESTS 27 139 0 700
70911786 I_AM_GRUTE A Feb. 12, 2020, 6:29 p.m. OK Python 3 TESTS 27 139 0 700
70848881 deepu1877 A Feb. 12, 2020, 2:17 p.m. OK Python 3 TESTS 27 139 0 700
70756592 justanothernewbie A Feb. 10, 2020, 9:27 p.m. OK Python 3 TESTS 27 139 0 700
70717185 mohi07 A Feb. 10, 2020, 8:56 a.m. OK Python 3 TESTS 27 139 0 700
70711612 cympfh A Feb. 10, 2020, 7:09 a.m. OK Rust TESTS 27 62 0 700
70646747 hir12111 A Feb. 9, 2020, 2:34 p.m. OK Rust TESTS 27 62 102400 700
70681708 ttn.blackstar A Feb. 9, 2020, 5:12 p.m. OK Scala TESTS 27 529 0 700
70805680 Sharganov-Vladimir A Feb. 11, 2020, 6:22 p.m. OK Scala TESTS 27 530 0 700

remove filters

Back to search problems