Codeforces Round 871 (Div. 4)

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
1829 Codeforces Round 871 (Div. 4) FINISHED False 8100 53796263 May 6, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 29518 ) C Mr. Perfectly Fine PROGRAMMING bitmasks greedy implementation 800

B'Victor wants to become "Mr. Perfectly Fine". For that, he needs to acquire a certain set of skills. More precisely, he has 2 skills he needs to acquire. Victor has n books. Reading book i takes him m_i minutes and will give him some (possibly none) of the required two skills, represented by a binary string of length 2 . What is the minimum amount of time required so that Victor acquires all of the two skills? The input consists of multiple test cases. The first line contains an integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains an integer n ( 1 <= q n <= q 2 cdot 10^5 ) -- the number of books available. Then n lines follow. Line i contains a positive integer m_i ( 1 <= q m_i <= q 2 cdot 10^5 ) and a binary string of length 2 , where s_{i1} = 1 if reading book i acquires Victor skill 1 , and s_{i1} = 0 otherwise, and s_{i2} = 1 if reading book i acquires Victor skill 2 , and s_{i2} = 0 otherwise. It is guaranteed that the sum of n over all test cases doesn 't exceed 2 cdot 10^5 . For each test case, output a single integer denoting the minimum amount of minutes required for Victor to obtain both needed skills and -1 in case it 's impossible to obtain the two skills after reading any amount of books. In the first test case, we can use books 2 and 3 , with a total amount of minutes spent equal to 3 + 4 = 7 . In the second test case, we can use the books 1 and 4 , with a total amount of minutes spent equal to 3 + 2 = 5 . In the third test case, we have only one option and that is reading book 1 for a total amount of minutes spent equal to 5 . '...

Tutorials

Codeforces Round 871 (Div. 4) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
205672864 bkifhr9 C May 13, 2023, 5:32 a.m. OK Clang++17 Diagnostics TESTS 16 124 0 800
205671419 vjudge3 C May 13, 2023, 5:17 a.m. OK Clang++17 Diagnostics TESTS 16 156 14233600 800
205673932 bkifhr9 C May 13, 2023, 5:43 a.m. OK Clang++17 Diagnostics TESTS 16 1013 0 800
205669229 vjudge4 C May 13, 2023, 4:47 a.m. OK Clang++17 Diagnostics TESTS 16 1138 0 800
205669444 bkifhr6 C May 13, 2023, 4:50 a.m. OK Clang++17 Diagnostics TESTS 16 1154 6144000 800
205669963 vjudge5 C May 13, 2023, 4:57 a.m. OK Clang++17 Diagnostics TESTS 16 1170 0 800
205668194 2000031101_Satwika C May 13, 2023, 4:32 a.m. OK Clang++17 Diagnostics TESTS 16 1216 20889600 800
205669860 bkifhr6 C May 13, 2023, 4:56 a.m. OK Clang++17 Diagnostics TESTS 16 1356 0 800
205672451 vjudge3 C May 13, 2023, 5:28 a.m. OK Clang++17 Diagnostics TESTS 16 1559 2662400 800
205669437 bkifhr10 C May 13, 2023, 4:50 a.m. OK Clang++20 Diagnostics TESTS 16 358 0 800
205675781 vjudge1 C May 13, 2023, 6:03 a.m. OK Clang++20 Diagnostics TESTS 16 1138 0 800
205670092 bkifhr6 C May 13, 2023, 4:59 a.m. OK Clang++20 Diagnostics TESTS 16 1138 0 800
205671810 vjudge5 C May 13, 2023, 5:21 a.m. OK Clang++20 Diagnostics TESTS 16 1138 3481600 800
205726623 vjudge1 C May 13, 2023, 1:57 p.m. OK Clang++20 Diagnostics TESTS 16 1325 1843200 800
205727675 zxccvvb C May 13, 2023, 2:09 p.m. OK Clang++20 Diagnostics TESTS 16 1341 1843200 800
205697497 ItsMeKing C May 13, 2023, 9:12 a.m. OK Clang++20 Diagnostics TESTS 16 1387 3993600 800
205788742 chanakya_SGTO C May 14, 2023, 5:55 a.m. OK Clang++20 Diagnostics TESTS 16 1388 0 800
205670356 bkifhr9 C May 13, 2023, 5:03 a.m. OK Clang++20 Diagnostics TESTS 16 1481 15360000 800
205732559 HardikMakkar C May 13, 2023, 2:56 p.m. OK GNU C11 TESTS 16 62 0 800
206183626 Mr.whiterrr C May 17, 2023, 8:07 a.m. OK GNU C11 TESTS 16 62 0 800
205803770 Md.Fahim1643 C May 14, 2023, 8:08 a.m. OK GNU C11 TESTS 16 62 0 800
205966387 bnurgeldiyev514 C May 15, 2023, 10:09 a.m. OK GNU C11 TESTS 16 62 0 800
206456924 rajesh19 C May 19, 2023, 2:24 p.m. OK GNU C11 TESTS 16 62 819200 800
205800288 mittalshivam_2709 C May 14, 2023, 7:39 a.m. OK GNU C11 TESTS 16 62 1638400 800
206318571 homerme99 C May 18, 2023, 9:13 a.m. OK GNU C11 TESTS 16 62 2355200 800
206356047 meghanakotha2004 C May 18, 2023, 3:02 p.m. OK GNU C11 TESTS 16 62 3174400 800
205966484 bnurgeldiyev514 C May 15, 2023, 10:10 a.m. OK GNU C11 TESTS 16 77 0 800
205731828 HardikMakkar C May 13, 2023, 2:49 p.m. OK GNU C11 TESTS 16 77 0 800
206215366 c20231020__ C May 17, 2023, 1:19 p.m. OK GNU C++14 TESTS 16 31 2150400 800
205922738 Betanine C May 14, 2023, 8:53 p.m. OK GNU C++14 TESTS 16 62 0 800
205670280 luogu_bot1 C May 13, 2023, 5:02 a.m. OK GNU C++14 TESTS 16 62 0 800
205692194 luogu_bot4 C May 13, 2023, 8:30 a.m. OK GNU C++14 TESTS 16 62 0 800
205787764 zhicheng C May 14, 2023, 5:44 a.m. OK GNU C++14 TESTS 16 62 0 800
205538425 number2 C May 12, 2023, 1 p.m. OK GNU C++14 TESTS 16 62 0 800
206058676 jaikhatri9827 C May 16, 2023, 7:38 a.m. OK GNU C++14 TESTS 16 62 1740800 800
205533320 shivani_2205 C May 12, 2023, 12:14 p.m. OK GNU C++14 TESTS 16 62 3174400 800
205670247 bkifhr7 C May 13, 2023, 5:01 a.m. OK GNU C++14 TESTS 16 62 3174400 800
206153087 tanker2 C May 16, 2023, 8:11 p.m. OK GNU C++14 TESTS 16 62 5632000 800
205940407 sharmavishal18617 C May 15, 2023, 4:32 a.m. OK GNU C++17 TESTS 16 46 0 800
206344310 ishaque28 C May 18, 2023, 1:18 p.m. OK GNU C++17 TESTS 16 46 0 800
205623529 imronsfrv C May 12, 2023, 5:05 p.m. OK GNU C++17 TESTS 16 62 0 800
206405789 CRYP70N1C C May 19, 2023, 5:19 a.m. OK GNU C++17 TESTS 16 62 0 800
206273986 joao_sarmento C May 17, 2023, 6:44 p.m. OK GNU C++17 TESTS 16 62 0 800
206204931 lllsssjjj C May 17, 2023, 11:46 a.m. OK GNU C++17 TESTS 16 62 0 800
206132416 ioana_ C May 16, 2023, 4:13 p.m. OK GNU C++17 TESTS 16 62 0 800
206017669 himanshi18 C May 15, 2023, 6:05 p.m. OK GNU C++17 TESTS 16 62 0 800
205589448 21h51a6677 C May 12, 2023, 3:29 p.m. OK GNU C++17 TESTS 16 62 0 800
205546934 anmattroi C May 12, 2023, 2:19 p.m. OK GNU C++17 TESTS 16 62 0 800
205716954 HKing147 C May 13, 2023, 12:26 p.m. OK GNU C++17 (64) TESTS 16 46 0 800
206301528 Hangbust C May 18, 2023, 5:58 a.m. OK GNU C++17 (64) TESTS 16 46 0 800
206156832 novaa C May 16, 2023, 9:26 p.m. OK GNU C++17 (64) TESTS 16 46 0 800
206065427 Avvis C May 16, 2023, 9:01 a.m. OK GNU C++17 (64) TESTS 16 46 0 800
206015784 soum1313 C May 15, 2023, 5:44 p.m. OK GNU C++17 (64) TESTS 16 46 0 800
205959911 1QWERTpoiuy C May 15, 2023, 9 a.m. OK GNU C++17 (64) TESTS 16 46 0 800
205943501 sasisushma C May 15, 2023, 5:24 a.m. OK GNU C++17 (64) TESTS 16 46 0 800
205770672 youssefhassan1717 C May 13, 2023, 10:38 p.m. OK GNU C++17 (64) TESTS 16 46 0 800
205735670 ABarnawal C May 13, 2023, 3:27 p.m. OK GNU C++17 (64) TESTS 16 46 0 800
205803196 bkifhr8 C May 14, 2023, 8:03 a.m. OK GNU C++17 (64) TESTS 16 46 409600 800
206208724 c1120231020 C May 17, 2023, 12:19 p.m. OK GNU C++20 (64) TESTS 16 15 2048000 800
206315289 Saket03 C May 18, 2023, 8:40 a.m. OK GNU C++20 (64) TESTS 16 31 0 800
205663610 roy_22 C May 13, 2023, 3:22 a.m. OK GNU C++20 (64) TESTS 16 31 0 800
205693286 myLastFight C May 13, 2023, 8:38 a.m. OK GNU C++20 (64) TESTS 16 31 0 800
205950802 Kareem_Khaled C May 15, 2023, 7:10 a.m. OK GNU C++20 (64) TESTS 16 31 0 800
206016511 rana47cvt C May 15, 2023, 5:52 p.m. OK GNU C++20 (64) TESTS 16 31 0 800
206023204 dsanvlkdnsvlkdffslk C May 15, 2023, 7:11 p.m. OK GNU C++20 (64) TESTS 16 31 0 800
206135396 Anton_Bakhet C May 16, 2023, 4:50 p.m. OK GNU C++20 (64) TESTS 16 31 0 800
206272986 lilyuan C May 17, 2023, 6:30 p.m. OK GNU C++20 (64) TESTS 16 31 0 800
206578547 N_Speed C May 20, 2023, 1:25 a.m. OK GNU C++20 (64) TESTS 16 46 0 800
206216883 KreanXie C May 17, 2023, 1:32 p.m. OK Go TESTS 16 156 7782400 800
205807522 johnny16 C May 14, 2023, 8:40 a.m. OK Java 11 TESTS 16 202 0 800
205742212 hassanU C May 13, 2023, 4:31 p.m. OK Java 11 TESTS 16 249 0 800
206426648 kocko C May 19, 2023, 9:15 a.m. OK Java 11 TESTS 16 264 5017600 800
205670029 2000031326 C May 13, 2023, 4:58 a.m. OK Java 11 TESTS 16 499 0 800
205762804 vaibhav20257 C May 13, 2023, 8:07 p.m. OK Java 11 TESTS 16 514 0 800
206087389 alpinodeli C May 16, 2023, 12:38 p.m. OK Java 11 TESTS 16 529 0 800
205717682 CSE_30143 C May 13, 2023, 12:32 p.m. OK Java 11 TESTS 16 545 0 800
206236522 Still. C May 17, 2023, 3:40 p.m. OK Java 11 TESTS 16 592 0 800
205685803 autra_weiliu C May 13, 2023, 7:27 a.m. OK Java 11 TESTS 16 592 0 800
205823974 Anuj4072 C May 14, 2023, 11:04 a.m. OK Java 11 TESTS 16 685 2150400 800
206222260 Vrutik_2809 C May 17, 2023, 2:23 p.m. OK Java 17 TESTS 16 218 307200 800
206452422 OBrutus C May 19, 2023, 1:37 p.m. OK Java 17 TESTS 16 265 204800 800
206223784 burning_summer C May 17, 2023, 2:37 p.m. OK Java 17 TESTS 16 280 307200 800
206149963 1xdeadc0de C May 16, 2023, 7:25 p.m. OK Java 17 TESTS 16 295 716800 800
205904055 mcrash12 C May 14, 2023, 5:14 p.m. OK Java 17 TESTS 16 296 409600 800
206065222 hai.le C May 16, 2023, 8:59 a.m. OK Java 17 TESTS 16 311 204800 800
206102306 pavelputin03 C May 16, 2023, 2:54 p.m. OK Java 17 TESTS 16 343 102400 800
206008813 varunsh17 C May 15, 2023, 4:30 p.m. OK Java 17 TESTS 16 405 1331200 800
206174349 mukhopadhyaypushan42 C May 17, 2023, 6:10 a.m. OK Java 17 TESTS 16 576 921600 800
205983146 mrizzzz_03 C May 15, 2023, 12:53 p.m. OK Java 17 TESTS 16 577 0 800
206174717 Sadler_H C May 17, 2023, 6:17 a.m. OK Java 8 TESTS 16 140 0 800
205623703 scor32k C May 12, 2023, 5:06 p.m. OK Java 8 TESTS 16 140 0 800
206079509 tgd1115 C May 16, 2023, 11:26 a.m. OK Java 8 TESTS 16 155 0 800
205683266 kkyb C May 13, 2023, 7:08 a.m. OK Java 8 TESTS 16 155 0 800
206438346 Yi_ling233 C May 19, 2023, 11:17 a.m. OK Java 8 TESTS 16 171 0 800
206335720 cssk15 C May 18, 2023, 11:57 a.m. OK Java 8 TESTS 16 420 0 800
206356138 PriyaMannur C May 18, 2023, 3:03 p.m. OK Java 8 TESTS 16 421 0 800
206173288 zeelpokar1234 C May 17, 2023, 5:39 a.m. OK Java 8 TESTS 16 421 0 800
206336350 cssk15 C May 18, 2023, 12:03 p.m. OK Java 8 TESTS 16 436 0 800
206185319 muffin1998 C May 17, 2023, 8:27 a.m. OK Java 8 TESTS 16 436 0 800
205768227 kerbes C May 13, 2023, 9:36 p.m. OK JavaScript TESTS 16 155 2150400 800
205768335 kerbes C May 13, 2023, 9:38 p.m. OK JavaScript TESTS 16 155 2457600 800
205837928 lungualex00 C May 14, 2023, 1:39 p.m. OK Kotlin 1.7 TESTS 16 592 96358400 800
205541078 starHamster C May 12, 2023, 1:23 p.m. OK Kotlin 1.7 TESTS 16 842 103731200 800
206312251 Fr1en C May 18, 2023, 8:09 a.m. OK MS C++ 2017 TESTS 16 218 0 800
205958495 Rafie78 C May 15, 2023, 8:44 a.m. OK MS C++ 2017 TESTS 16 234 0 800
206169167 Pranay32 C May 17, 2023, 3:57 a.m. OK MS C++ 2017 TESTS 16 234 9318400 800
205923621 InterstellarGuo C May 14, 2023, 9:08 p.m. OK MS C++ 2017 TESTS 16 249 96153600 800
205923519 InterstellarGuo C May 14, 2023, 9:06 p.m. OK MS C++ 2017 TESTS 16 249 96153600 800
206345013 _jriitd C May 18, 2023, 1:24 p.m. OK MS C++ 2017 TESTS 16 280 0 800
205789538 JiangMH C May 14, 2023, 6:04 a.m. OK MS C++ 2017 TESTS 16 296 2252800 800
206389716 Liberator187 C May 18, 2023, 10:15 p.m. OK PyPy 3 TESTS 16 217 27648000 800
205644827 SlayerOfShit C May 12, 2023, 8:17 p.m. OK PyPy 3 TESTS 16 1465 11264000 800
205967186 vjudge5 C May 15, 2023, 10:19 a.m. OK PyPy 3 TESTS 16 1481 9523200 800
205929976 whoami096 C May 15, 2023, 12:20 a.m. OK PyPy 3 TESTS 16 1481 10547200 800
205597825 beautifulworld C May 12, 2023, 3:47 p.m. OK PyPy 3 TESTS 16 1496 13107200 800
205777929 _magnificent_ C May 14, 2023, 2:54 a.m. OK PyPy 3 TESTS 16 1497 10240000 800
205696882 lol_py C May 13, 2023, 9:07 a.m. OK PyPy 3 TESTS 16 1497 11673600 800
206254355 shashankmanan C May 17, 2023, 5:11 p.m. OK PyPy 3 TESTS 16 1544 10956800 800
206390588 voicon C May 18, 2023, 10:46 p.m. OK PyPy 3-64 TESTS 16 139 10854400 800
205840721 Rhuto C May 14, 2023, 2:09 p.m. OK PyPy 3-64 TESTS 16 140 7270400 800
206405069 ZaeThrix C May 19, 2023, 5:07 a.m. OK PyPy 3-64 TESTS 16 140 10752000 800
206282523 pygasuss C May 17, 2023, 9:41 p.m. OK PyPy 3-64 TESTS 16 140 15052800 800
205760888 sangeeta C May 13, 2023, 7:44 p.m. OK PyPy 3-64 TESTS 16 155 11776000 800
206024499 mazsolamacko C May 15, 2023, 7:29 p.m. OK PyPy 3-64 TESTS 16 171 34304000 800
206352871 Sam_Jiang C May 18, 2023, 2:33 p.m. OK PyPy 3-64 TESTS 16 186 11776000 800
206103759 practiceaccount76 C May 16, 2023, 3:07 p.m. OK PyPy 3-64 TESTS 16 187 9216000 800
206036785 s_prateek26 C May 16, 2023, 12:52 a.m. OK PyPy 3-64 TESTS 16 218 18944000 800
206438753 Chiho C May 19, 2023, 11:21 a.m. OK PyPy 3-64 TESTS 16 343 51404800 800
206346587 sergeantsnape C May 18, 2023, 1:37 p.m. OK Python 3 TESTS 16 187 9216000 800
205730531 eastsky712 zero7103 C May 13, 2023, 2:37 p.m. OK Python 3 TESTS 16 249 0 800
205771784 casqi C May 13, 2023, 11:19 p.m. OK Python 3 TESTS 16 249 9216000 800
206462939 Vladpoch C May 19, 2023, 2:41 p.m. OK Python 3 TESTS 16 265 0 800
206281150 sivefunc C May 17, 2023, 9:01 p.m. OK Python 3 TESTS 16 265 9625600 800
206527197 yajirobe C May 19, 2023, 4:13 p.m. OK Python 3 TESTS 16 280 0 800
206091862 ljx007 C May 16, 2023, 1:18 p.m. OK Python 3 TESTS 16 280 9420800 800
205883248 xlk C May 14, 2023, 3:35 p.m. OK Python 3 TESTS 16 280 9728000 800
206282473 pygasuss C May 17, 2023, 9:40 p.m. OK Python 3 TESTS 16 280 21401600 800
205832989 MafiaLogiki C May 14, 2023, 12:45 p.m. OK Python 3 TESTS 16 295 0 800
206060062 5I7Coding C May 16, 2023, 7:57 a.m. OK Rust 2021 TESTS 16 46 0 800
206355398 tobeApe6eHok C May 18, 2023, 2:56 p.m. OK Rust 2021 TESTS 16 78 0 800

remove filters

Back to search problems