Codeforces Global Round 18

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
1615 Codeforces Global Round 18 FINISHED False 9000 96909863 Dec. 24, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8537 ) C Menorah PROGRAMMING brute force graphs greedy math

B"There are n candles on a Hanukkah menorah, and some of its candles are initially lit. We can describe which candles are lit with a binary string s , where the i -th candle is lit if and only if s_i=1 . Initially, the candle lights are described by a string a . In an operation, you select a candle that is currently lit. By doing so, the candle you selected will remain lit, and every other candle will change (if it was lit, it will become unlit and if it was unlit, it will become lit). You would like to make the candles look the same as string b . Your task is to determine if it is possible, and if it is, find the minimum number of operations required. The first line contains an integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then t cases follow. The first line of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the number of candles. The second line contains a string a of length n consisting of symbols 0 and 1 -- the initial pattern of lights. The third line contains a string b of length n consisting of symbols 0 and 1 -- the desired pattern of lights. It is guaranteed that the sum of n does not exceed 10^5 . For each test case, output the minimum number of operations required to transform a to b , or -1 if it's impossible. In the first test case, the two strings are already equal, so we don't have to perform any operations. In the second test case, we can perform a single operation selecting the second candle to transform 01 into 11 . In the third test case, it's impossible to perform any operations because there are no lit candles to select. In the fourth test case, we can perform the following operations to transform a into b : In the fifth test case, we can perform the following operations to transform a into b : "...

Tutorials

Global Round 18 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
140498735 ssvb C Dec. 24, 2021, 4:37 p.m. OK D TESTS 14 30 6553600
140526712 gxlois C Dec. 24, 2021, 9:59 p.m. OK D TESTS 14 31 4198400
140504108 eastnman C Dec. 24, 2021, 4:57 p.m. OK Delphi TESTS 14 46 409600
140512624 the__ignorant C Dec. 24, 2021, 6:08 p.m. OK GNU C11 TESTS 14 31 409600
140493585 YtTheBot C Dec. 24, 2021, 4:19 p.m. OK GNU C11 TESTS 14 61 409600
140515377 jay_jayjay C Dec. 24, 2021, 6:37 p.m. OK GNU C11 TESTS 14 62 614400
140531197 luogu_bot4 C Dec. 25, 2021, 1:22 a.m. OK GNU C++14 TESTS 14 15 204800
140530870 themoon C Dec. 25, 2021, 1:11 a.m. OK GNU C++14 TESTS 14 15 204800
140530643 JoesSR C Dec. 25, 2021, 1:04 a.m. OK GNU C++14 TESTS 14 15 204800
140516978 airbust C Dec. 24, 2021, 6:56 p.m. OK GNU C++14 TESTS 14 15 204800
140497961 Minus_Stardust C Dec. 24, 2021, 4:34 p.m. OK GNU C++14 TESTS 14 15 204800
140495953 haimin C Dec. 24, 2021, 4:27 p.m. OK GNU C++14 TESTS 14 15 204800
140494132 likely C Dec. 24, 2021, 4:21 p.m. OK GNU C++14 TESTS 14 15 204800
140493925 abcdeffa C Dec. 24, 2021, 4:20 p.m. OK GNU C++14 TESTS 14 15 204800
140531203 chengcheng567 C Dec. 25, 2021, 1:22 a.m. OK GNU C++14 TESTS 14 15 204800
140536793 5ab C Dec. 25, 2021, 4 a.m. OK GNU C++14 TESTS 14 15 204800
140539159 kmyiu C Dec. 25, 2021, 4:47 a.m. OK GNU C++17 TESTS 14 15 204800
140536791 Jakon C Dec. 25, 2021, 4 a.m. OK GNU C++17 TESTS 14 15 204800
140535320 Coder_he C Dec. 25, 2021, 3:23 a.m. OK GNU C++17 TESTS 14 15 204800
140520347 NexTopper C Dec. 24, 2021, 7:40 p.m. OK GNU C++17 TESTS 14 15 204800
140510915 skywalkert C Dec. 24, 2021, 5:50 p.m. OK GNU C++17 TESTS 14 15 204800
140510666 skywalkert C Dec. 24, 2021, 5:48 p.m. OK GNU C++17 TESTS 14 15 204800
140508379 Monarchuwu C Dec. 24, 2021, 5:28 p.m. OK GNU C++17 TESTS 14 15 204800
140504776 keduoli C Dec. 24, 2021, 4:59 p.m. OK GNU C++17 TESTS 14 15 204800
140542835 eopXD C Dec. 25, 2021, 5:42 a.m. OK GNU C++17 TESTS 14 15 204800
140539050 milan_s1 C Dec. 25, 2021, 4:45 a.m. OK GNU C++17 TESTS 14 15 204800
140534353 Evang C Dec. 25, 2021, 2:56 a.m. OK GNU C++17 (64) TESTS 14 15 204800
140496201 panyaoyu C Dec. 24, 2021, 4:28 p.m. OK GNU C++17 (64) TESTS 14 15 204800
140495719 ainta C Dec. 24, 2021, 4:26 p.m. OK GNU C++17 (64) TESTS 14 15 409600
140539683 unoexphaha C Dec. 25, 2021, 4:56 a.m. OK GNU C++17 (64) TESTS 14 15 512000
140542886 _Mafia C Dec. 25, 2021, 5:43 a.m. OK GNU C++17 (64) TESTS 14 15 512000
140543037 Mohammad_Yasser C Dec. 25, 2021, 5:45 a.m. OK GNU C++17 (64) TESTS 14 15 512000
140539221 unoexphaha C Dec. 25, 2021, 4:48 a.m. OK GNU C++17 (64) TESTS 14 15 512000
140536970 amar277 C Dec. 25, 2021, 4:04 a.m. OK GNU C++17 (64) TESTS 14 15 512000
140541456 try_target C Dec. 25, 2021, 5:24 a.m. OK GNU C++17 (64) TESTS 14 15 512000
140540182 MXTL C Dec. 25, 2021, 5:04 a.m. OK GNU C++17 (64) TESTS 14 15 512000
140532025 i.am.anubhav C Dec. 25, 2021, 1:49 a.m. OK GNU C++20 (64) TESTS 14 0 512000
140519685 Patrusheva_Anna C Dec. 24, 2021, 7:30 p.m. OK GNU C++20 (64) TESTS 14 15 204800
140507851 maxplus C Dec. 24, 2021, 5:25 p.m. OK GNU C++20 (64) TESTS 14 15 307200
140536766 666EGOR777 C Dec. 25, 2021, 4 a.m. OK GNU C++20 (64) TESTS 14 15 307200
140496784 DoTran C Dec. 24, 2021, 4:30 p.m. OK GNU C++20 (64) TESTS 14 15 307200
140505714 abhijha C Dec. 24, 2021, 5:03 p.m. OK GNU C++20 (64) TESTS 14 15 307200
140508433 bashem C Dec. 24, 2021, 5:29 p.m. OK GNU C++20 (64) TESTS 14 15 307200
140544095 vaibhav.goyal C Dec. 25, 2021, 5:59 a.m. OK GNU C++20 (64) TESTS 14 15 409600
140541965 ankushbhagat14 C Dec. 25, 2021, 5:30 a.m. OK GNU C++20 (64) TESTS 14 15 409600
140540410 QsR11 C Dec. 25, 2021, 5:08 a.m. OK GNU C++20 (64) TESTS 14 15 409600
140504777 glebsamsonov C Dec. 24, 2021, 4:59 p.m. OK Go TESTS 14 62 921600
140538501 Satyaa C Dec. 25, 2021, 4:35 a.m. OK Java 11 TESTS 14 171 0
140513409 henrychenOutlook C Dec. 24, 2021, 6:16 p.m. OK Java 11 TESTS 14 187 0
140502951 long2142453426 C Dec. 24, 2021, 4:53 p.m. OK Java 11 TESTS 14 202 0
140502487 dheerajchhatanidc C Dec. 24, 2021, 4:51 p.m. OK Java 11 TESTS 14 202 0
140494331 yaminote C Dec. 24, 2021, 4:22 p.m. OK Java 11 TESTS 14 202 0
140528260 LongWalk C Dec. 24, 2021, 11:01 p.m. OK Java 11 TESTS 14 218 0
140505757 EFuzzy C Dec. 24, 2021, 5:03 p.m. OK Java 11 TESTS 14 264 0
140521051 anubhav44044 C Dec. 24, 2021, 7:50 p.m. OK Java 11 TESTS 14 264 0
140511253 LucunJi C Dec. 24, 2021, 5:54 p.m. OK Java 11 TESTS 14 264 0
140537780 pritambarnwal114 C Dec. 25, 2021, 4:21 a.m. OK Java 11 TESTS 14 280 0
140503277 SecondThread C Dec. 24, 2021, 4:54 p.m. OK Java 8 TESTS 14 109 0
140526055 invincible777 C Dec. 24, 2021, 9:40 p.m. OK Java 8 TESTS 14 124 0
140505463 Adi_7861 C Dec. 24, 2021, 5:02 p.m. OK Java 8 TESTS 14 124 0
140499698 NerfThis C Dec. 24, 2021, 4:41 p.m. OK Java 8 TESTS 14 124 0
140498954 Vinay_Goel_ C Dec. 24, 2021, 4:38 p.m. OK Java 8 TESTS 14 124 0
140491924 kelvinc1024 C Dec. 24, 2021, 4:14 p.m. OK Java 8 TESTS 14 124 0
140498530 BLET_KHAKIM C Dec. 24, 2021, 4:36 p.m. OK Java 8 TESTS 14 124 0
140541968 kyrie_start C Dec. 25, 2021, 5:30 a.m. OK Java 8 TESTS 14 124 0
140501305 ganesh_6 C Dec. 24, 2021, 4:47 p.m. OK Java 8 TESTS 14 140 0
140543029 lzwjava C Dec. 25, 2021, 5:45 a.m. OK Java 8 TESTS 14 140 0
140503541 Bisquito C Dec. 24, 2021, 4:55 p.m. OK Kotlin 1.4 TESTS 14 171 0
140493814 PavelChadnov C Dec. 24, 2021, 4:20 p.m. OK Kotlin 1.4 TESTS 14 295 18534400
140491100 serglag C Dec. 24, 2021, 4:11 p.m. OK MS C++ 2017 TESTS 14 61 307200
140512273 XianztsZhong C Dec. 24, 2021, 6:05 p.m. OK MS C++ 2017 TESTS 14 61 409600
140491428 dino_merlin C Dec. 24, 2021, 4:12 p.m. OK MS C++ 2017 TESTS 14 62 307200
140535883 A_Pier C Dec. 25, 2021, 3:37 a.m. OK MS C++ 2017 TESTS 14 62 409600
140504397 fatant C Dec. 24, 2021, 4:58 p.m. OK MS C++ 2017 TESTS 14 93 0
140496229 jeroeng C Dec. 24, 2021, 4:28 p.m. OK .NET Core C# TESTS 14 124 1843200
140508077 1_2_3_4_5_9 C Dec. 24, 2021, 5:26 p.m. OK PyPy 2 TESTS 14 186 4915200
140503223 14_15_16 C Dec. 24, 2021, 4:54 p.m. OK PyPy 2 TESTS 14 186 4915200
140510252 OLOGY C Dec. 24, 2021, 5:43 p.m. OK PyPy 2 TESTS 14 248 6758400
140537029 ambs_ C Dec. 25, 2021, 4:05 a.m. OK PyPy 3 TESTS 14 171 7065600
140497204 yonsweng C Dec. 24, 2021, 4:32 p.m. OK PyPy 3 TESTS 14 171 7884800
140493987 YMSeah C Dec. 24, 2021, 4:21 p.m. OK PyPy 3 TESTS 14 202 6144000
140521477 gennadylaptev C Dec. 24, 2021, 7:58 p.m. OK PyPy 3 TESTS 14 202 9523200
140507917 AbnerShen C Dec. 24, 2021, 5:25 p.m. OK PyPy 3 TESTS 14 218 9011200
140509110 AbnerShen C Dec. 24, 2021, 5:33 p.m. OK PyPy 3 TESTS 14 233 9523200
140494148 iimmortal C Dec. 24, 2021, 4:21 p.m. OK PyPy 3 TESTS 14 233 9625600
140526701 Bad_day_toCode C Dec. 24, 2021, 9:59 p.m. OK PyPy 3 TESTS 14 233 9830400
140536203 Liberator187 C Dec. 25, 2021, 3:46 a.m. OK PyPy 3 TESTS 14 248 9932800
140537359 armsusman C Dec. 25, 2021, 4:12 a.m. OK PyPy 3 TESTS 14 342 10547200
140503717 queme C Dec. 24, 2021, 4:56 p.m. OK PyPy 3-64 TESTS 14 249 9420800
140522810 sjwhole C Dec. 24, 2021, 8:22 p.m. OK PyPy 3-64 TESTS 14 249 9830400
140503656 agarus C Dec. 24, 2021, 4:55 p.m. OK PyPy 3-64 TESTS 14 280 9011200
140511849 rivnam C Dec. 24, 2021, 6 p.m. OK PyPy 3-64 TESTS 14 295 13824000
140511578 Nemisis2.O C Dec. 24, 2021, 5:57 p.m. OK PyPy 3-64 TESTS 14 295 13824000
140512975 Nemisis2.O C Dec. 24, 2021, 6:12 p.m. OK PyPy 3-64 TESTS 14 296 13107200
140509791 jaglike_makkar C Dec. 24, 2021, 5:39 p.m. OK PyPy 3-64 TESTS 14 311 9523200
140503409 Himanshu_Kaithal C Dec. 24, 2021, 4:55 p.m. OK PyPy 3-64 TESTS 14 405 14540800
140507941 190330228 C Dec. 24, 2021, 5:25 p.m. OK PyPy 3-64 TESTS 14 452 9011200
140513543 Dr_Strange C Dec. 24, 2021, 6:18 p.m. OK PyPy 3-64 TESTS 14 452 9625600
140510286 OLOGY C Dec. 24, 2021, 5:44 p.m. OK Python 2 TESTS 14 171 1638400
140508589 OLOGY C Dec. 24, 2021, 5:30 p.m. OK Python 2 TESTS 14 171 1638400
140526400 KeiTsukishima C Dec. 24, 2021, 9:50 p.m. OK Python 3 TESTS 14 124 1638400
140526385 KeiTsukishima C Dec. 24, 2021, 9:49 p.m. OK Python 3 TESTS 14 124 1740800
140524262 MistaAsh C Dec. 24, 2021, 8:52 p.m. OK Python 3 TESTS 14 155 512000
140510195 lkm_codeforces C Dec. 24, 2021, 5:43 p.m. OK Python 3 TESTS 14 156 10956800
140508954 midouni C Dec. 24, 2021, 5:32 p.m. OK Python 3 TESTS 14 170 512000
140504315 gck_16 C Dec. 24, 2021, 4:58 p.m. OK Python 3 TESTS 14 171 512000
140496065 arjasc521 C Dec. 24, 2021, 4:28 p.m. OK Python 3 TESTS 14 171 512000
140504481 satyamshrma C Dec. 24, 2021, 4:58 p.m. OK Python 3 TESTS 14 186 512000
140494638 ruimina C Dec. 24, 2021, 4:23 p.m. OK Python 3 TESTS 14 187 512000
140538199 okay123 C Dec. 25, 2021, 4:30 a.m. OK Python 3 TESTS 14 187 4096000
140525942 kumalimak C Dec. 24, 2021, 9:36 p.m. OK Rust 2021 TESTS 14 31 1331200
140495538 cottoncotton C Dec. 24, 2021, 4:26 p.m. OK Rust 2021 TESTS 14 46 67379200

remove filters

Back to search problems