Codeforces Round 142 (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
229 Codeforces Round 142 (Div. 1) FINISHED False 7500 382717799 Oct. 1, 2012, 3:30 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3525 ) A Shifts PROGRAMMING brute force two pointers 1600

B'You are given a table consisting of n rows and m columns. Each cell of the table contains a number, 0 or 1. In one move we can choose some row of the table and cyclically shift its values either one cell to the left, or one cell to the right. To cyclically shift a table row one cell to the right means to move the value of each cell, except for the last one, to the right neighboring cell, and to move the value of the last cell to the first cell. A cyclical shift of a row to the left is performed similarly, but in the other direction. For example, if we cyclically shift a row "00110" one cell to the right, we get a row "00011", but if we shift a row "00110" one cell to the left, we get a row "01100". Determine the minimum number of moves needed to make some table column consist only of numbers 1. The first line contains two space-separated integers: n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100) -- the number of rows in the table and m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89104) -- the number of columns in the table. Then n lines follow, each of them contains m characters "0" or "1": the j-th character of the i-th line describes the contents of the cell in the i-th row and in the j-th column of the table. It is guaranteed that the description of the table contains no other characters besides "0" and "1". Print a single number: the minimum number of moves needed to get only numbers 1 in some column of the table. If this is impossible, print -1. In the first sample one way to achieve the goal with the least number of moves is as follows: cyclically shift the second row to the right once, then shift the third row to the left twice. Then the table column before the last one will contain only 1s. In the second sample one can 't shift the rows to get a column containing only 1s.'...

Tutorials

Codeforces Round #142 Problem Analysis

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
2295528 FxF A Oct. 3, 2012, 12:08 p.m. OK Delphi TESTS 59 62 204800 1600
2287060 Misha100896 A Oct. 1, 2012, 7:21 p.m. OK Delphi TESTS 59 62 5120000 1600
2292960 Golovanov399 A Oct. 2, 2012, 4:07 p.m. OK Delphi TESTS 59 62 9932800 1600
2293946 romanychda A Oct. 2, 2012, 8:56 p.m. OK Delphi TESTS 59 62 16076800 1600
2291866 Oryshych A Oct. 2, 2012, 12:48 p.m. OK Delphi TESTS 59 78 921600 1600
2275589 Timur_Keks A Oct. 1, 2012, 3:44 p.m. OK Delphi TESTS 59 78 4300800 1600
2282448 equi A Oct. 1, 2012, 4:44 p.m. OK Delphi TESTS 59 78 12083200 1600
2288015 TarasSavitskyi A Oct. 1, 2012, 9:29 p.m. OK Delphi TESTS 59 93 54169600 1600
2278614 ruban A Oct. 1, 2012, 4:05 p.m. OK Delphi TESTS 59 93 182169600 1600
2290370 AleksanderBalobanov A Oct. 2, 2012, 7:39 a.m. OK Delphi TESTS 59 109 12083200 1600
2297503 ljcc A Oct. 4, 2012, 3:01 a.m. OK FPC TESTS 59 46 5120000 1600
3135592 Nik_Storm_2010 A Feb. 16, 2013, 7:29 a.m. OK FPC TESTS 59 62 5222400 1600
2287400 scorpion A Oct. 1, 2012, 7:44 p.m. OK FPC TESTS 59 62 5222400 1600
2292606 mxalbert1996 A Oct. 2, 2012, 2:43 p.m. OK FPC TESTS 59 62 6144000 1600
3317207 BrightDays A March 14, 2013, 4:18 p.m. OK FPC TESTS 59 62 8192000 1600
6476596 graceoflives A April 26, 2014, 4:23 a.m. OK FPC TESTS 59 62 9216000 1600
3992114 Omelianenko A June 29, 2013, 2:26 p.m. OK FPC TESTS 59 62 9318400 1600
2275655 M0sTik A Oct. 1, 2012, 3:45 p.m. OK FPC TESTS 59 62 10137600 1600
3452668 Rubanenko A April 2, 2013, 11:52 a.m. OK FPC TESTS 59 62 10649600 1600
2294093 usg A Oct. 2, 2012, 10:19 p.m. OK FPC TESTS 59 78 4096000 1600
3823346 vjudge3 A June 5, 2013, 2:32 a.m. OK GNU C TESTS 59 31 102400 1600
3666513 guilhermemb11 A May 4, 2013, 1:42 a.m. OK GNU C TESTS 59 31 102400 1600
2605581 vjudge4 A Nov. 20, 2012, 1:21 p.m. OK GNU C TESTS 59 62 4505600 1600
2289656 cpy A Oct. 2, 2012, 5:34 a.m. OK GNU C TESTS 59 62 5120000 1600
28986179 Barceloner A July 30, 2017, 8:35 a.m. OK GNU C TESTS 59 62 6144000 1600
2287846 RodrigoBurgos A Oct. 1, 2012, 8:46 p.m. OK GNU C TESTS 59 78 102400 1600
2291301 hariprasath A Oct. 2, 2012, 11:06 a.m. OK GNU C TESTS 59 78 6348800 1600
4824683 IanAlbuquerque A Oct. 19, 2013, 12:39 p.m. OK GNU C++ TESTS 59 30 1126400 1600
4819709 NTaveras A Oct. 18, 2013, 1:25 p.m. OK GNU C++ TESTS 59 30 4096000 1600
4349487 yangff A Aug. 26, 2013, 4:57 p.m. OK GNU C++ TESTS 59 30 12390400 1600
3817866 vjudge3 A June 3, 2013, 7:11 a.m. OK GNU C++ TESTS 59 31 102400 1600
3817864 SCSE12_zhixing A June 3, 2013, 7:10 a.m. OK GNU C++ TESTS 59 31 102400 1600
3501596 GreyAnts A April 11, 2013, 12:31 a.m. OK GNU C++ TESTS 59 31 102400 1600
2880234 c175353 A Jan. 7, 2013, 10:08 a.m. OK GNU C++ TESTS 59 31 204800 1600
3729739 vjudge4 A May 17, 2013, 3 p.m. OK GNU C++ TESTS 59 31 307200 1600
2847587 lasten A Dec. 28, 2012, 7:32 a.m. OK GNU C++ TESTS 59 31 921600 1600
2297355 severin A Oct. 4, 2012, 12:18 a.m. OK GNU C++ TESTS 59 31 4096000 1600
2292236 Archon.JK A Oct. 2, 2012, 1:39 p.m. OK GNU C++0x TESTS 59 46 5017600 1600
2442878 yejinru A Oct. 27, 2012, 1:29 p.m. OK GNU C++0x TESTS 59 46 9523200 1600
4563770 Orfest A Sept. 25, 2013, 8:56 p.m. OK GNU C++0x TESTS 59 62 0 1600
5524307 JayYe A Dec. 26, 2013, 10:51 a.m. OK GNU C++0x TESTS 59 62 1126400 1600
2283917 savinov A Oct. 1, 2012, 5:04 p.m. OK GNU C++0x TESTS 59 62 1126400 1600
2293589 tzador A Oct. 2, 2012, 6:32 p.m. OK GNU C++0x TESTS 59 62 3993600 1600
5527553 enrevol A Dec. 26, 2013, 11:37 p.m. OK GNU C++0x TESTS 59 62 4198400 1600
7538024 ztk A Aug. 21, 2014, 12:33 a.m. OK GNU C++0x TESTS 59 62 5017600 1600
8519776 nic11 A Nov. 2, 2014, 5:02 a.m. OK GNU C++0x TESTS 59 62 5120000 1600
2288556 Dr. A Oct. 2, 2012, 1:40 a.m. OK GNU C++0x TESTS 59 62 5324800 1600
11674698 merolish A June 19, 2015, 9:09 p.m. OK GNU C11 TESTS 59 62 102400 1600
58834982 rainboy A Aug. 14, 2019, 8:10 p.m. OK GNU C11 TESTS 59 92 102400 1600
14214899 Marcil A Nov. 12, 2015, 1:50 p.m. OK GNU C++11 TESTS 59 60 13721600 1600
17268562 KhaledEltahan A April 10, 2016, 5:32 p.m. OK GNU C++11 TESTS 59 62 102400 1600
21904720 pulkitmehta A Oct. 31, 2016, 6:49 a.m. OK GNU C++11 TESTS 59 62 307200 1600
15536732 spetsnaz A Jan. 23, 2016, 5:27 p.m. OK GNU C++11 TESTS 59 62 1126400 1600
15467719 Batman A Jan. 21, 2016, 11:51 a.m. OK GNU C++11 TESTS 59 62 1638400 1600
24333529 demon1999 A Feb. 1, 2017, 5:33 a.m. OK GNU C++11 TESTS 59 62 2150400 1600
19968993 sugar A Aug. 19, 2016, 6:08 p.m. OK GNU C++11 TESTS 59 62 2252800 1600
17885562 vjudge3 A May 13, 2016, 8:08 a.m. OK GNU C++11 TESTS 59 62 3379200 1600
32665311 edisonhello A Nov. 26, 2017, 7:53 a.m. OK GNU C++11 TESTS 59 62 3584000 1600
16310610 mostafa_thabet A Feb. 24, 2016, 2:35 p.m. OK GNU C++11 TESTS 59 62 3993600 1600
33640168 Harshad A Dec. 26, 2017, 8:33 a.m. OK GNU C++14 TESTS 59 60 7475200 1600
30579372 vjudge3 A Sept. 21, 2017, 1:38 p.m. OK GNU C++14 TESTS 59 62 102400 1600
24032199 after A Jan. 22, 2017, 2:25 p.m. OK GNU C++14 TESTS 59 62 1945600 1600
29552367 eisenheim01 A Aug. 18, 2017, 11:36 a.m. OK GNU C++14 TESTS 59 62 4096000 1600
30819762 LiChenKoh A Sept. 29, 2017, 3:53 a.m. OK GNU C++14 TESTS 59 62 5734400 1600
20987223 Indecchi A Sept. 29, 2016, 9:02 a.m. OK GNU C++14 TESTS 59 62 5939200 1600
21366892 skrillex7 A Oct. 11, 2016, 6:24 p.m. OK GNU C++14 TESTS 59 62 5939200 1600
31587164 AlexandruValeanu A Oct. 21, 2017, 9:18 p.m. OK GNU C++14 TESTS 59 62 7577600 1600
30990588 e19-un A Oct. 4, 2017, 11:31 a.m. OK GNU C++14 TESTS 59 62 9523200 1600
33251026 TheNotorious A Dec. 14, 2017, 9:35 p.m. OK GNU C++14 TESTS 59 62 11059200 1600
51386476 mishok A March 16, 2019, 7:03 p.m. OK GNU C++17 TESTS 59 92 5017600 1600
57888250 vjudge3 A July 28, 2019, 10:50 a.m. OK GNU C++17 TESTS 59 92 8294400 1600
57888400 2018216494 A July 28, 2019, 10:53 a.m. OK GNU C++17 TESTS 59 92 8294400 1600
55692649 Vrikodara A June 17, 2019, 7:09 p.m. OK GNU C++17 TESTS 59 92 8396800 1600
47188084 harishmara98 A Dec. 18, 2018, 6:32 a.m. OK GNU C++17 TESTS 59 92 8806400 1600
56181692 Quinas A June 28, 2019, 12:29 a.m. OK GNU C++17 TESTS 59 92 11264000 1600
68093465 sohailk1999 A Jan. 2, 2020, 7:18 p.m. OK GNU C++17 TESTS 59 92 12492800 1600
50804077 xyw5vplus1 A March 5, 2019, 3:32 a.m. OK GNU C++17 TESTS 59 122 7987200 1600
61578295 cyansea A Sept. 30, 2019, 10:53 p.m. OK GNU C++17 TESTS 59 122 10240000 1600
49749752 MVHE A Feb. 11, 2019, 1:43 a.m. OK GNU C++17 TESTS 59 122 18432000 1600
8094544 kaiysh A Oct. 5, 2014, 3:12 p.m. OK Go TESTS 59 248 9728000 1600
6713736 erikr A May 26, 2014, 6:58 a.m. OK Haskell TESTS 59 156 9625600 1600
67571507 DATVN A Dec. 24, 2019, 10:09 p.m. OK Java 11 TESTS 59 436 6144000 1600
2319991 samolovov A Oct. 7, 2012, 7:45 p.m. OK Java 6 TESTS 59 125 0 1600
2275884 Aksenov239 A Oct. 1, 2012, 3:46 p.m. OK Java 6 TESTS 59 125 0 1600
2276179 Slamur A Oct. 1, 2012, 3:48 p.m. OK Java 6 TESTS 59 125 307200 1600
4047966 mkirsche A July 10, 2013, 7:14 p.m. OK Java 6 TESTS 59 140 0 1600
2580332 pschuprikov A Nov. 17, 2012, 5:13 p.m. OK Java 6 TESTS 59 140 0 1600
2361338 hama-du A Oct. 15, 2012, 3:25 p.m. OK Java 6 TESTS 59 140 102400 1600
2276628 Gleb A Oct. 1, 2012, 3:51 p.m. OK Java 6 TESTS 59 140 204800 1600
3013798 svm11 A Jan. 26, 2013, 5:56 p.m. OK Java 6 TESTS 59 156 0 1600
2604847 Kornacker A Nov. 20, 2012, 11:23 a.m. OK Java 6 TESTS 59 156 0 1600
2289157 Azat_Yusupov A Oct. 2, 2012, 3:52 a.m. OK Java 6 TESTS 59 156 0 1600
2275898 niquefa_diego A Oct. 1, 2012, 3:46 p.m. OK Java 7 TESTS 59 125 0 1600
2298006 trunghieu11 A Oct. 4, 2012, 6:59 a.m. OK Java 7 TESTS 59 156 0 1600
2275267 jiangzhijie A Oct. 1, 2012, 3:43 p.m. OK Java 7 TESTS 59 156 102400 1600
2275969 OutSide A Oct. 1, 2012, 3:47 p.m. OK Java 7 TESTS 59 171 204800 1600
2274334 alexey.enkov A Oct. 1, 2012, 3:38 p.m. OK Java 7 TESTS 59 171 204800 1600
5617288 sfmunera A Jan. 4, 2014, 5:17 p.m. OK Java 7 TESTS 59 186 0 1600
5617269 sfmunera A Jan. 4, 2014, 5:14 p.m. OK Java 7 TESTS 59 186 0 1600
2288794 nitegazer A Oct. 2, 2012, 2:32 a.m. OK Java 7 TESTS 59 187 102400 1600
2286225 yarrr A Oct. 1, 2012, 6:50 p.m. OK Java 7 TESTS 59 187 204800 1600
2277600 Jovfer A Oct. 1, 2012, 3:58 p.m. OK Java 7 TESTS 59 187 14950400 1600
27682930 unequitedscript A June 9, 2017, 5:45 a.m. OK Java 8 TESTS 59 248 102400 1600
13307130 Nirmit A Sept. 30, 2015, 12:42 a.m. OK Java 8 TESTS 59 280 0 1600
12385521 .tx A Aug. 6, 2015, 9:06 a.m. OK Java 8 TESTS 59 280 0 1600
11573055 sweiss A June 13, 2015, 7:21 p.m. OK Java 8 TESTS 59 280 0 1600
9562137 Aidos A Jan. 26, 2015, 3:34 p.m. OK Java 8 TESTS 59 280 0 1600
24290504 tomdmitriev A Jan. 31, 2017, 1:04 p.m. OK Java 8 TESTS 59 280 20582400 1600
10209586 AlexFetisov A March 8, 2015, 3:50 p.m. OK Java 8 TESTS 59 310 0 1600
11907104 santa_calus A July 3, 2015, 7:19 a.m. OK Java 8 TESTS 59 312 0 1600
9946368 poikniok A Feb. 21, 2015, 9:22 a.m. OK Java 8 TESTS 59 372 0 1600
9946430 poikniok A Feb. 21, 2015, 9:30 a.m. OK Java 8 TESTS 59 374 0 1600
2926604 Guliash A Jan. 15, 2013, 10:08 a.m. OK Mono C# TESTS 59 62 14950400 1600
2309178 al2 A Oct. 6, 2012, 9:46 p.m. OK Mono C# TESTS 59 140 5836800 1600
2278629 mylifefordota A Oct. 1, 2012, 4:05 p.m. OK Mono C# TESTS 59 703 10035200 1600
2286609 zaq1xsw2tktk A Oct. 1, 2012, 7 p.m. OK Mono C# TESTS 59 734 5734400 1600
2290122 fiver A Oct. 2, 2012, 6:55 a.m. OK Mono C# TESTS 59 843 6758400 1600
2281202 it4.kp A Oct. 1, 2012, 4:29 p.m. OK Mono C# TESTS 59 906 13721600 1600
13480848 og.kostya A Oct. 7, 2015, 4:57 p.m. OK MS C# TESTS 59 156 8192000 1600
8069217 scanhex A Oct. 3, 2014, 2:08 p.m. OK MS C# TESTS 59 436 18636800 1600
2277978 Entuser A Oct. 1, 2012, 4:01 p.m. OK MS C++ TESTS 59 31 5017600 1600
4025584 RiKang A July 5, 2013, 8:01 a.m. OK MS C++ TESTS 59 31 8396800 1600
2335569 gotoac A Oct. 10, 2012, 12:38 p.m. OK MS C++ TESTS 59 46 102400 1600
2300894 mugurelionut A Oct. 5, 2012, 12:31 a.m. OK MS C++ TESTS 59 46 1024000 1600
2288998 zqhzx A Oct. 2, 2012, 3:18 a.m. OK MS C++ TESTS 59 46 1126400 1600
2301077 qq20091200 A Oct. 5, 2012, 3:53 a.m. OK MS C++ TESTS 59 46 4096000 1600
2276349 tyamgin A Oct. 1, 2012, 3:49 p.m. OK MS C++ TESTS 59 46 5120000 1600
2629512 mrzero717 A Nov. 22, 2012, 10:51 p.m. OK MS C++ TESTS 59 46 5222400 1600
2287248 YX201314 A Oct. 1, 2012, 7:33 p.m. OK MS C++ TESTS 59 46 5222400 1600
2289699 skyhll A Oct. 2, 2012, 5:45 a.m. OK MS C++ TESTS 59 46 5529600 1600
58512620 CtrlAlt A Aug. 9, 2019, 8:01 p.m. OK MS C++ 2017 TESTS 59 310 5529600 1600
27677419 mayakin A June 8, 2017, 6:50 p.m. OK PHP TESTS 59 1620 512000 1600
35126703 cxt A Feb. 10, 2018, 1:56 p.m. OK PyPy 3 TESTS 59 436 31641600 1600
35127789 cxt A Feb. 10, 2018, 2:28 p.m. OK PyPy 3 TESTS 59 468 30310400 1600
51934196 ashok123 A March 28, 2019, 11:48 a.m. OK PyPy 3 TESTS 59 498 10240000 1600
35127670 cxt A Feb. 10, 2018, 2:25 p.m. OK PyPy 3 TESTS 59 498 30822400 1600
35848988 ______u______ A March 2, 2018, 5:07 p.m. OK PyPy 3 TESTS 59 528 30310400 1600
35848873 ______n______ A March 2, 2018, 5:06 p.m. OK PyPy 3 TESTS 59 528 30310400 1600
35848589 _____i_____ A March 2, 2018, 5:01 p.m. OK PyPy 3 TESTS 59 528 30310400 1600
35848233 _____k_____ A March 2, 2018, 4:56 p.m. OK PyPy 3 TESTS 59 528 30310400 1600
35841658 ______h______ A March 2, 2018, 2:38 p.m. OK PyPy 3 TESTS 59 528 30310400 1600
35841501 ______k______ A March 2, 2018, 2:37 p.m. OK PyPy 3 TESTS 59 528 30310400 1600
5286179 yugle7 A Nov. 28, 2013, 12:03 p.m. OK Python 2 TESTS 59 686 1740800 1600
2306525 stareven A Oct. 6, 2012, 11:57 a.m. OK Python 2 TESTS 59 1031 2048000 1600
2685473 cm3 A Dec. 2, 2012, 4:31 a.m. OK Python 2 TESTS 59 1328 2048000 1600
2685440 cm3 A Dec. 2, 2012, 3:49 a.m. OK Python 2 TESTS 59 1515 20480000 1600
2339469 hota911 A Oct. 11, 2012, 2:48 p.m. OK Python 2 TESTS 59 1703 921600 1600
4980154 Unlenin A Nov. 3, 2013, 2:52 p.m. OK Python 2 TESTS 59 1778 1228800 1600
2304805 changyuheng A Oct. 6, 2012, 5:37 a.m. OK Python 2 TESTS 59 1859 16998400 1600
2304540 changyuheng A Oct. 6, 2012, 5:24 a.m. OK Python 2 TESTS 59 1890 16998400 1600
2293654 tzador A Oct. 2, 2012, 6:55 p.m. OK Python 2 TESTS 59 1906 15667200 1600
15914099 not_bot_but_POT A Feb. 9, 2016, 1:38 p.m. OK Python 2 TESTS 59 1934 1126400 1600
5286166 yugle7 A Nov. 28, 2013, 12:01 p.m. OK Python 3 TESTS 59 872 819200 1600

remove filters

Back to search problems