Codeforces Round 419 (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
815 Codeforces Round 419 (Div. 1) FINISHED False 7200 239469863 June 17, 2017, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 5688 ) A Karen and Game PROGRAMMING brute force greedy implementation 1700

B'On the way to school, Karen became fixated on the puzzle game on her phone! The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0. One move consists of choosing one row or column, and adding 1 to all of the cells in that row or column. To win the level, after all the moves, the number in the cell at the i-th row and j-th column should be equal to gi, xe2 x80 x89j. Karen is stuck on one level, and wants to know a way to beat this level using the minimum number of moves. Please, help her with this task! The first line of input contains two integers, n and m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100), the number of rows and the number of columns in the grid, respectively. The next n lines each contain m integers. In particular, the j-th integer in the i-th of these rows contains gi, xe2 x80 x89j (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89gi, xe2 x80 x89j xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89500). If there is an error and it is actually not possible to beat the level, output a single integer -1. Otherwise, on the first line, output a single integer k, the minimum number of moves necessary to beat the level. The next k lines should each contain one of the following, describing the moves in the order they must be done: If there are multiple optimal solutions, output any one of them. In the first test case, Karen has a grid with 3 rows and 5 columns. She can perform the following 4 moves to beat the level: In the second test case, Karen has a grid with 3 rows and 3 columns. It is clear that it is impossible to beat the level; performing any move will create three 1s on the grid, but it is required to only have one 1 in the center. In the third test case, Karen has a grid with 3 rows and 3 columns. She can perform the following 3 moves to beat the level: Note that this is not the only solution; another solution, among others, is col 1, col 2, col 3. '...

Tutorials

Codeforces Round #419 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
27851663 Gassa A June 17, 2017, 2:56 p.m. OK D TESTS 177 30 0 1700
27908351 nanae1914 A June 19, 2017, 4:01 p.m. OK D TESTS 177 46 0 1700
47145983 rr_ A Dec. 17, 2018, 2:22 a.m. OK D TESTS 177 46 4198400 1700
47146023 rr_ A Dec. 17, 2018, 2:25 a.m. OK D TESTS 177 46 4300800 1700
27875894 HuyHoang A June 18, 2017, 3:51 a.m. OK FPC TESTS 177 108 12083200 1700
27935302 Zulqarnaen A June 21, 2017, 2:13 a.m. OK FPC TESTS 177 155 2560000 1700
27920712 hagen_ A June 20, 2017, 8:47 a.m. OK GNU C TESTS 177 31 0 1700
27884885 gbrocks A June 18, 2017, 12:54 p.m. OK GNU C TESTS 177 31 204800 1700
27924646 minhaz725 A June 20, 2017, 12:13 p.m. OK GNU C TESTS 177 31 1843200 1700
28175666 nikitachaturvedi A June 30, 2017, 3:12 p.m. OK GNU C TESTS 177 31 1945600 1700
27970129 rstk1 A June 22, 2017, 5:23 p.m. OK GNU C TESTS 177 31 1945600 1700
33597954 Sumukh_Bhardwaj A Dec. 24, 2017, 5:07 p.m. OK GNU C TESTS 177 31 2048000 1700
27863347 sgtlaugh A June 17, 2017, 4:19 p.m. OK GNU C TESTS 177 31 208588800 1700
38011411 mahabir10 A May 8, 2018, 4:39 a.m. OK GNU C TESTS 177 46 3379200 1700
27868360 1919810 A June 17, 2017, 6:44 p.m. OK GNU C++ TESTS 177 30 0 1700
27850562 wings_forever A June 17, 2017, 2:51 p.m. OK GNU C++ TESTS 177 30 0 1700
27851012 zyding A June 17, 2017, 2:53 p.m. OK GNU C++ TESTS 177 30 102400 1700
28661863 zhengyang A July 18, 2017, 8:22 a.m. OK GNU C++ TESTS 177 30 2048000 1700
34562644 vjudge1 A Jan. 26, 2018, 2:51 a.m. OK GNU C++ TESTS 177 30 2150400 1700
28718144 Parachutes A July 20, 2017, 8:29 a.m. OK GNU C++ TESTS 177 30 2150400 1700
28661435 zhengyang A July 18, 2017, 8:07 a.m. OK GNU C++ TESTS 177 30 2252800 1700
34563683 vjudge2 A Jan. 26, 2018, 3:58 a.m. OK GNU C++ TESTS 177 30 3072000 1700
34562769 vjudge3 A Jan. 26, 2018, 3 a.m. OK GNU C++ TESTS 177 30 14131200 1700
31865610 Nickwzk A Oct. 29, 2017, 11:57 a.m. OK GNU C++ TESTS 177 31 0 1700
27920687 ashraful16 A June 20, 2017, 8:46 a.m. OK GNU C11 TESTS 177 234 102400 1700
27926550 YMYMY A June 20, 2017, 1:57 p.m. OK GNU C++11 TESTS 177 15 1945600 1700
27934832 Haidar_Kanaan A June 21, 2017, 1:22 a.m. OK GNU C++11 TESTS 177 30 0 1700
27877012 GreymaneSilverfang A June 18, 2017, 5:23 a.m. OK GNU C++11 TESTS 177 30 0 1700
27866850 aya_elymany A June 17, 2017, 6:06 p.m. OK GNU C++11 TESTS 177 30 0 1700
27849718 ___LH A June 17, 2017, 2:47 p.m. OK GNU C++11 TESTS 177 30 204800 1700
27849527 SirShokoladina A June 17, 2017, 2:46 p.m. OK GNU C++11 TESTS 177 30 1126400 1700
28926637 iamqzh A July 27, 2017, 9:29 a.m. OK GNU C++11 TESTS 177 30 3174400 1700
29868197 289371298 A Aug. 29, 2017, 2:23 p.m. OK GNU C++11 TESTS 177 31 0 1700
69720803 luogu_bot1 A Jan. 29, 2020, 10:34 a.m. OK GNU C++11 TESTS 177 31 0 1700
45233622 2016wudi A Nov. 3, 2018, 8:16 a.m. OK GNU C++11 TESTS 177 31 0 1700
27883185 liu_runda A June 18, 2017, 11:08 a.m. OK GNU C++14 TESTS 177 15 0 1700
27920457 ae04071 A June 20, 2017, 8:35 a.m. OK GNU C++14 TESTS 177 15 102400 1700
27860123 Arg_007 A June 17, 2017, 3:52 p.m. OK GNU C++14 TESTS 177 15 204800 1700
27851063 TangentDay A June 17, 2017, 2:53 p.m. OK GNU C++14 TESTS 177 15 1126400 1700
29236733 orzwzy A Aug. 6, 2017, 8:42 a.m. OK GNU C++14 TESTS 177 15 1945600 1700
28952341 Valour A July 28, 2017, 12:04 p.m. OK GNU C++14 TESTS 177 15 1945600 1700
28945817 rpSebastian A July 28, 2017, 7:22 a.m. OK GNU C++14 TESTS 177 15 1945600 1700
27926844 YOUSIKI A June 20, 2017, 2:15 p.m. OK GNU C++14 TESTS 177 15 1945600 1700
27855988 dreamoon_love_AA A June 17, 2017, 3:22 p.m. OK GNU C++14 TESTS 177 15 2150400 1700
27926022 SendThemToHell A June 20, 2017, 1:26 p.m. OK GNU C++14 TESTS 177 15 2150400 1700
54004777 sammithkanur A May 11, 2019, 6:59 p.m. OK GNU C++17 TESTS 177 31 102400 1700
50472124 dars A Feb. 25, 2019, 2:10 a.m. OK GNU C++17 TESTS 177 31 204800 1700
52494028 noob77777 A April 8, 2019, 12:54 p.m. OK GNU C++17 TESTS 177 31 204800 1700
48664533 zpr A Jan. 21, 2019, 7:30 a.m. OK GNU C++17 TESTS 177 31 307200 1700
44546352 vjudge2 A Oct. 19, 2018, 1:37 p.m. OK GNU C++17 TESTS 177 31 307200 1700
49505192 yasminealmohandes A Feb. 5, 2019, 5:10 p.m. OK GNU C++17 TESTS 177 31 307200 1700
48665589 woshimolei A Jan. 21, 2019, 8 a.m. OK GNU C++17 TESTS 177 31 307200 1700
45204473 vjudge2 A Nov. 2, 2018, 11:58 a.m. OK GNU C++17 TESTS 177 31 716800 1700
52232955 doge233 A April 2, 2019, 12:38 p.m. OK GNU C++17 TESTS 177 31 1228800 1700
43360110 f4ded4k A Sept. 24, 2018, 8:47 a.m. OK GNU C++17 TESTS 177 31 1536000 1700
27850535 Martynas A June 17, 2017, 2:50 p.m. OK Go TESTS 177 46 20377600 1700
28264943 roma-vat A July 3, 2017, 9:15 p.m. OK Go TESTS 177 249 24166400 1700
28271872 roma-vat A July 4, 2017, 6:08 a.m. OK Go TESTS 177 249 38912000 1700
28075263 nicon A June 27, 2017, 11:23 a.m. OK Haskell TESTS 177 62 54272000 1700
58086091 adeepgarg13 A July 31, 2019, 3:40 p.m. OK Java 8 TESTS 177 124 0 1700
28054797 Mahakarma A June 26, 2017, 9:59 a.m. OK Java 8 TESTS 177 124 21299200 1700
28014798 Brayan.Restrepo A June 25, 2017, 2:57 a.m. OK Java 8 TESTS 177 124 21606400 1700
27939471 Vlad3d A June 21, 2017, 7:25 a.m. OK Java 8 TESTS 177 139 21196800 1700
28210942 accessdog A July 2, 2017, 1:08 p.m. OK Java 8 TESTS 177 139 21196800 1700
63269452 yaoct A Oct. 24, 2019, 2:59 a.m. OK Java 8 TESTS 177 140 0 1700
30561611 Slamur A Sept. 20, 2017, 8:54 p.m. OK Java 8 TESTS 177 140 0 1700
27867148 prashanth_rebala A June 17, 2017, 6:11 p.m. OK Java 8 TESTS 177 140 0 1700
27865379 AndreySiunov A June 17, 2017, 4:34 p.m. OK Java 8 TESTS 177 140 0 1700
27850616 Azat_Yusupov A June 17, 2017, 2:51 p.m. OK Java 8 TESTS 177 140 0 1700
27859616 leign A June 17, 2017, 3:48 p.m. OK Mono C# TESTS 177 77 3686400 1700
51895556 nemars A March 27, 2019, 11:23 a.m. OK Mono C# TESTS 177 78 7372800 1700
27915154 Sipher A June 20, 2017, 1:26 a.m. OK MS C# TESTS 177 171 6041600 1700
27873308 camypaper A June 18, 2017, 12:36 a.m. OK MS C# TESTS 177 296 179609600 1700
27850185 witua A June 17, 2017, 2:49 p.m. OK MS C++ TESTS 177 31 204800 1700
27862807 Vedensky A June 17, 2017, 4:15 p.m. OK MS C++ TESTS 177 31 716800 1700
30242155 ALWAYSWANNAFLY A Sept. 10, 2017, 9:51 a.m. OK MS C++ TESTS 177 31 1331200 1700
27940827 InZei A June 21, 2017, 8:27 a.m. OK MS C++ TESTS 177 31 2150400 1700
27976135 lu925871076 A June 23, 2017, 3:31 a.m. OK MS C++ TESTS 177 31 2150400 1700
27946375 InZei A June 21, 2017, 1:04 p.m. OK MS C++ TESTS 177 31 2150400 1700
27851372 olpetOdessaONU A June 17, 2017, 2:54 p.m. OK MS C++ TESTS 177 31 3584000 1700
52537666 xiaorenshi A April 9, 2019, 4:26 p.m. OK MS C++ TESTS 177 31 16384000 1700
34563186 vjudge4 A Jan. 26, 2018, 3:24 a.m. OK MS C++ TESTS 177 31 82227200 1700
34562980 vjudge3 A Jan. 26, 2018, 3:13 a.m. OK MS C++ TESTS 177 31 82227200 1700
58576341 Denko A Aug. 11, 2019, 12:34 p.m. OK MS C++ 2017 TESTS 177 46 921600 1700
59131555 CtrlAlt A Aug. 20, 2019, 11:12 a.m. OK MS C++ 2017 TESTS 177 62 1740800 1700
27937276 instantkill A June 21, 2017, 4:56 a.m. OK Ocaml TESTS 177 171 5734400 1700
27885820 mayakin A June 18, 2017, 1:55 p.m. OK PHP TESTS 177 576 5734400 1700
27866831 dpforest A June 17, 2017, 6:06 p.m. OK PyPy 2 TESTS 177 233 11980800 1700
27912671 rex321 A June 19, 2017, 8:37 p.m. OK PyPy 2 TESTS 177 763 3993600 1700
27870137 Noureldin A June 17, 2017, 8 p.m. OK PyPy 2 TESTS 177 779 3686400 1700
57595721 kopok2 A July 23, 2019, 1:52 p.m. OK PyPy 3 TESTS 177 311 5939200 1700
27894903 nealzane A June 19, 2017, 3:34 a.m. OK Python 2 TESTS 177 93 921600 1700
28059123 Ericcwang A June 26, 2017, 2:01 p.m. OK Python 2 TESTS 177 93 4915200 1700
27849312 nwi A June 17, 2017, 2:45 p.m. OK Python 2 TESTS 177 108 204800 1700
28419154 wangzpeng A July 11, 2017, 3:48 a.m. OK Python 2 TESTS 177 108 5120000 1700
27901215 franckmy A June 19, 2017, 9:38 a.m. OK Python 2 TESTS 177 109 921600 1700
27870602 a2linx A June 17, 2017, 8:28 p.m. OK Python 2 TESTS 177 109 1126400 1700
31233882 c_h_a_n A Oct. 12, 2017, 6:49 a.m. OK Python 2 TESTS 177 109 2867200 1700
30480030 c_h_a_n A Sept. 18, 2017, 5:07 p.m. OK Python 2 TESTS 177 109 7372800 1700
28700390 isgulkov A July 19, 2017, 3:40 p.m. OK Python 2 TESTS 177 109 7475200 1700
27864706 catupper A June 17, 2017, 4:30 p.m. OK Python 2 TESTS 177 124 5120000 1700
27849257 --d A June 17, 2017, 2:45 p.m. OK Python 3 TESTS 177 108 3788800 1700
38471700 omarnvidia A May 21, 2018, 12:01 a.m. OK Python 3 TESTS 177 109 1945600 1700
48908067 toysheeyeyraku A Jan. 24, 2019, 10:25 p.m. OK Python 3 TESTS 177 124 1843200 1700
40405566 orailly A July 16, 2018, 9:35 a.m. OK Python 3 TESTS 177 124 1945600 1700
37990218 cabaleirog A May 7, 2018, 9:46 a.m. OK Python 3 TESTS 177 187 10137600 1700
67437874 N3RDSLQYER84 A Dec. 22, 2019, 5:58 p.m. OK Python 3 TESTS 177 218 2355200 1700
65400153 squiggly A Nov. 19, 2019, 9:22 p.m. OK Python 3 TESTS 177 233 921600 1700
27972782 OlMur A June 22, 2017, 8:42 p.m. OK Python 3 TESTS 177 296 7680000 1700
28055838 Zombarian A June 26, 2017, 11 a.m. OK Python 3 TESTS 177 311 6246400 1700
27938493 mohit28rawat A June 21, 2017, 6:27 a.m. OK Python 3 TESTS 177 311 6246400 1700
28188820 Aicvier A July 1, 2017, 9:46 a.m. OK Rust TESTS 177 109 1638400 1700
27869710 limed A June 17, 2017, 7:38 p.m. OK Scala TESTS 177 358 614400 1700

remove filters

Back to search problems