Codeforces Round 654 (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
1371 Codeforces Round 654 (Div. 2) FINISHED False 7200 138212699 July 1, 2020, 1:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 13029 ) D Grid-00100 PROGRAMMING constructive algorithms greedy math

B"A mad scientist Dr.Jubal has made a competitive programming task. Try to solve it! You are given integers n,k . Construct a grid A with size n x n consisting of integers 0 and 1 . The very important condition should be satisfied: the sum of all elements in the grid is exactly k . In other words, the number of 1 in the grid is equal to k . Let's define: Find any grid A , which satisfies the following condition. Among such grids find any, for which the value f(A) is the minimum possible. Among such tables, you can find any. The input consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. Next t lines contain descriptions of test cases. For each test case the only line contains two integers n , k (1 <= n <= 300, 0 <= k <= n^2) . It is guaranteed that the sum of n^2 for all test cases does not exceed 10^5 . For each test case, firstly print the minimum possible value of f(A) among all tables, for which the condition is satisfied. After that, print n lines contain n characters each. The j -th character in the i -th line should be equal to A_{i,j} . If there are multiple answers you can print any. In the first test case, the sum of all elements in the grid is equal to 2 , so the condition is satisfied. R_1 = 1, R_2 = 1 and C_1 = 1, C_2 = 1 . Then, f(A) = (1-1)^2 + (1-1)^2 = 0 , which is the minimum possible value of f(A) . In the second test case, the sum of all elements in the grid is equal to 8 , so the condition is satisfied. R_1 = 3, R_2 = 3, R_3 = 2 and C_1 = 3, C_2 = 2, C_3 = 3 . Then, f(A) = (3-2)^2 + (3-2)^2 = 2 . It can be proven, that it is the minimum possible value of f(A) . "...

Tutorials

Codeforces Round #654 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
85663239 daut-dlang D July 1, 2020, 2:30 p.m. OK D TESTS 60 31 4198400
85701457 Gassa D July 1, 2020, 4:56 p.m. OK D TESTS 60 46 0
85681462 Gassa D July 1, 2020, 3:06 p.m. OK D TESTS 60 46 0
85700915 Gassa D July 1, 2020, 4:53 p.m. OK D TESTS 60 46 0
85675345 ruban D July 1, 2020, 2:53 p.m. OK Delphi TESTS 60 46 13619200
85700178 physics0523 D July 1, 2020, 4:49 p.m. OK GNU C11 TESTS 60 46 102400
85739042 dangilajay9 D July 2, 2020, 5:37 a.m. OK GNU C11 TESTS 60 46 102400
85670345 singerl D July 1, 2020, 2:44 p.m. OK GNU C11 TESTS 60 343 0
85701208 Kartikeya_Singh03 D July 1, 2020, 4:54 p.m. OK GNU C11 TESTS 60 358 102400
85738178 nvskkalyan D July 2, 2020, 5:23 a.m. OK GNU C11 TESTS 60 358 307200
85709897 vladislav_k D July 1, 2020, 6:18 p.m. OK GNU C11 TESTS 60 358 409600
85703640 mrashid_5919 D July 1, 2020, 5:11 p.m. OK GNU C11 TESTS 60 358 409600
85674888 temmie_ D July 1, 2020, 2:52 p.m. OK GNU C11 TESTS 60 373 409600
85699621 RaviVK D July 1, 2020, 4:47 p.m. OK GNU C11 TESTS 60 374 409600
85724489 YSJY D July 2, 2020, 12:07 a.m. OK GNU C++11 TESTS 60 30 307200
85661781 rockphy D July 1, 2020, 2:28 p.m. OK GNU C++11 TESTS 60 31 0
85725905 Alanaxixi D July 2, 2020, 12:58 a.m. OK GNU C++11 TESTS 60 31 0
85662676 YOK D July 1, 2020, 2:29 p.m. OK GNU C++11 TESTS 60 31 0
85712068 divyanshu22.dm D July 1, 2020, 6:47 p.m. OK GNU C++11 TESTS 60 31 0
85734383 chenjinglong2333 D July 2, 2020, 4:18 a.m. OK GNU C++11 TESTS 60 31 0
85723994 el_heffeh D July 1, 2020, 11:45 p.m. OK GNU C++11 TESTS 60 31 102400
85708147 AhoVatija D July 1, 2020, 5:56 p.m. OK GNU C++11 TESTS 60 31 102400
85731478 vjudge1 D July 2, 2020, 3:19 a.m. OK GNU C++11 TESTS 60 31 102400
85739844 YHHxBULIATANIA D July 2, 2020, 5:48 a.m. OK GNU C++11 TESTS 60 31 102400
85669952 crash_owl D July 1, 2020, 2:43 p.m. OK GNU C++14 TESTS 60 31 0
85695020 youmei D July 1, 2020, 3:33 p.m. OK GNU C++14 TESTS 60 31 0
85692840 The_Ansh_Gupta D July 1, 2020, 3:29 p.m. OK GNU C++14 TESTS 60 31 0
85685138 JOYTUN_17 D July 1, 2020, 3:14 p.m. OK GNU C++14 TESTS 60 31 0
85706521 MehulJ D July 1, 2020, 5:39 p.m. OK GNU C++14 TESTS 60 31 0
85726014 rafle D July 2, 2020, 1:02 a.m. OK GNU C++14 TESTS 60 31 0
85667728 kumar11 D July 1, 2020, 2:39 p.m. OK GNU C++14 TESTS 60 31 0
85738136 praveenpathak D July 2, 2020, 5:22 a.m. OK GNU C++14 TESTS 60 31 102400
85738486 dhruvilsangani37 D July 2, 2020, 5:28 a.m. OK GNU C++14 TESTS 60 31 102400
85735967 sunilkannur.98 D July 2, 2020, 4:47 a.m. OK GNU C++14 TESTS 60 31 102400
85734800 as4sin_007 D July 2, 2020, 4:26 a.m. OK GNU C++17 TESTS 60 31 0
85712679 dinesh9547 D July 1, 2020, 6:55 p.m. OK GNU C++17 TESTS 60 31 0
85722062 dantaxyz D July 1, 2020, 10:29 p.m. OK GNU C++17 TESTS 60 31 0
85678575 Rafi22 D July 1, 2020, 3 p.m. OK GNU C++17 TESTS 60 31 102400
85736448 NikkUo D July 2, 2020, 4:55 a.m. OK GNU C++17 TESTS 60 31 102400
85734146 MazedRupok D July 2, 2020, 4:14 a.m. OK GNU C++17 TESTS 60 31 102400
85730904 I_Love_Tourist_ D July 2, 2020, 3:06 a.m. OK GNU C++17 TESTS 60 31 102400
85728937 ssatdd D July 2, 2020, 2:21 a.m. OK GNU C++17 TESTS 60 31 102400
85705113 ahmed2807 D July 1, 2020, 5:25 p.m. OK GNU C++17 TESTS 60 31 102400
85703474 tarun_sm D July 1, 2020, 5:10 p.m. OK GNU C++17 TESTS 60 31 102400
85687842 tchtchtch D July 1, 2020, 3:19 p.m. OK GNU C++17 (64) TESTS 60 31 0
85732186 dpw4112001 D July 2, 2020, 3:33 a.m. OK GNU C++17 (64) TESTS 60 31 102400
85671722 Alexfj08 D July 1, 2020, 2:46 p.m. OK GNU C++17 (64) TESTS 60 31 204800
85676264 raaghavraaj D July 1, 2020, 2:55 p.m. OK GNU C++17 (64) TESTS 60 31 204800
85704737 ecnerwala D July 1, 2020, 5:21 p.m. OK GNU C++17 (64) TESTS 60 31 204800
85668179 najebe D July 1, 2020, 2:39 p.m. OK GNU C++17 (64) TESTS 60 31 204800
85730742 Byte-Rider D July 2, 2020, 3:03 a.m. OK GNU C++17 (64) TESTS 60 31 204800
85711282 hemant1729 D July 1, 2020, 6:35 p.m. OK GNU C++17 (64) TESTS 60 31 307200
85716308 guptapratham42 D July 1, 2020, 7:54 p.m. OK GNU C++17 (64) TESTS 60 31 307200
85724479 FlowerOfSorrow D July 2, 2020, 12:06 a.m. OK GNU C++17 (64) TESTS 60 31 307200
85703280 ktateish D July 1, 2020, 5:08 p.m. OK Go TESTS 60 46 0
85711490 Xylenox D July 1, 2020, 6:38 p.m. OK Go TESTS 60 46 102400
85670211 maguroguma D July 1, 2020, 2:43 p.m. OK Go TESTS 60 61 0
85720434 Russell_Emerine D July 1, 2020, 9:37 p.m. OK Haskell TESTS 60 46 3174400
85672751 LCM D July 1, 2020, 2:48 p.m. OK Haskell TESTS 60 109 5324800
85718140 tirtho2107 D July 1, 2020, 8:35 p.m. OK Java 11 TESTS 60 171 0
85716586 idk321 D July 1, 2020, 8 p.m. OK Java 11 TESTS 60 186 0
85734881 kelvinc1024 D July 2, 2020, 4:27 a.m. OK Java 11 TESTS 60 187 0
85723544 Oopsimbad D July 1, 2020, 11:26 p.m. OK Java 11 TESTS 60 187 0
85715892 singhdhanwant D July 1, 2020, 7:47 p.m. OK Java 11 TESTS 60 187 0
85715538 typewriter999 D July 1, 2020, 7:41 p.m. OK Java 11 TESTS 60 187 0
85708150 chris_11 D July 1, 2020, 5:56 p.m. OK Java 11 TESTS 60 187 0
85705262 skittles1412 D July 1, 2020, 5:26 p.m. OK Java 11 TESTS 60 187 0
85704728 saikaushik D July 1, 2020, 5:21 p.m. OK Java 11 TESTS 60 187 0
85701180 noahlewis.ca D July 1, 2020, 4:54 p.m. OK Java 11 TESTS 60 187 0
85710530 anuj560 D July 1, 2020, 6:26 p.m. OK Java 8 TESTS 60 109 0
85738643 atharvat77 D July 2, 2020, 5:31 a.m. OK Java 8 TESTS 60 124 0
85734973 akshith1997 D July 2, 2020, 4:29 a.m. OK Java 8 TESTS 60 124 0
85734605 rgupta917 D July 2, 2020, 4:22 a.m. OK Java 8 TESTS 60 124 0
85734475 __kishankumar__ D July 2, 2020, 4:20 a.m. OK Java 8 TESTS 60 124 0
85732591 saiharish D July 2, 2020, 3:42 a.m. OK Java 8 TESTS 60 124 0
85731719 pulkit14 D July 2, 2020, 3:24 a.m. OK Java 8 TESTS 60 124 0
85730376 sudhanshu_lucky D July 2, 2020, 2:54 a.m. OK Java 8 TESTS 60 124 0
85728966 kpark D July 2, 2020, 2:22 a.m. OK Java 8 TESTS 60 124 0
85721059 aearly D July 1, 2020, 9:56 p.m. OK Java 8 TESTS 60 124 0
85681284 Loremon D July 1, 2020, 3:06 p.m. OK JavaScript TESTS 60 93 1945600
85726342 Spheniscine D July 2, 2020, 1:13 a.m. OK Kotlin TESTS 60 124 0
85738621 timurtibeyev D July 2, 2020, 5:30 a.m. OK Kotlin TESTS 60 140 0
85714596 Hakiobo D July 1, 2020, 7:25 p.m. OK Kotlin TESTS 60 171 512000
85707902 rocketm D July 1, 2020, 5:53 p.m. OK Kotlin TESTS 60 171 512000
85705158 abdukodir D July 1, 2020, 5:25 p.m. OK Kotlin TESTS 60 186 10240000
85691174 wuchaojie925 D July 1, 2020, 3:26 p.m. OK Kotlin TESTS 60 202 0
85673261 HaKuLess D July 1, 2020, 2:49 p.m. OK Kotlin TESTS 60 202 1228800
85673682 CepGamer D July 1, 2020, 2:50 p.m. OK Kotlin TESTS 60 483 1228800
85667248 riantkb D July 1, 2020, 2:38 p.m. OK Mono C# TESTS 60 77 2764800
85705069 maddenvvs D July 1, 2020, 5:24 p.m. OK Mono C# TESTS 60 93 2662400
85663121 eSeF_ D July 1, 2020, 2:30 p.m. OK Mono C# TESTS 60 109 74854400
85729189 Biang-Biang D July 2, 2020, 2:27 a.m. OK MS C++ TESTS 60 46 102400
85684233 jagajang D July 1, 2020, 3:12 p.m. OK MS C++ TESTS 60 46 409600
85668348 Goldexperienrce D July 1, 2020, 2:40 p.m. OK MS C++ TESTS 60 46 409600
85681893 duaduadua D July 1, 2020, 3:07 p.m. OK MS C++ 2017 TESTS 60 46 102400
85668749 Numbervan D July 1, 2020, 2:40 p.m. OK MS C++ 2017 TESTS 60 46 102400
85715799 xsc D July 1, 2020, 7:45 p.m. OK MS C++ 2017 TESTS 60 46 102400
85693734 scka D July 1, 2020, 3:31 p.m. OK MS C++ 2017 TESTS 60 46 409600
85663538 tarattata1 D July 1, 2020, 2:31 p.m. OK MS C++ 2017 TESTS 60 46 921600
85667739 youx D July 1, 2020, 2:39 p.m. OK MS C++ 2017 TESTS 60 46 1024000
85664488 JulesIMF D July 1, 2020, 2:33 p.m. OK MS C++ 2017 TESTS 60 62 512000
85666161 PrankMaN D July 1, 2020, 2:36 p.m. OK MS C++ 2017 TESTS 60 77 409600
85739489 skymin D July 2, 2020, 5:43 a.m. OK MS C++ 2017 TESTS 60 77 409600
85682413 jeehye D July 1, 2020, 3:08 p.m. OK MS C++ 2017 TESTS 60 77 409600
85692656 Mukundan314 D July 1, 2020, 3:29 p.m. OK PyPy 2 TESTS 60 140 1638400
85705901 realnimish D July 1, 2020, 5:33 p.m. OK PyPy 2 TESTS 60 170 1843200
85705789 realnimish D July 1, 2020, 5:32 p.m. OK PyPy 2 TESTS 60 171 2048000
85662002 c1729 D July 1, 2020, 2:28 p.m. OK PyPy 2 TESTS 60 171 2969600
85704762 raj1307 D July 1, 2020, 5:21 p.m. OK PyPy 2 TESTS 60 217 2662400
85692630 starkizard D July 1, 2020, 3:29 p.m. OK PyPy 2 TESTS 60 233 4300800
85696162 snape_here D July 1, 2020, 3:34 p.m. OK PyPy 2 TESTS 60 233 7577600
85667773 arccosh D July 1, 2020, 2:39 p.m. OK PyPy 2 TESTS 60 249 4608000
85698882 Satwik_Tiwari D July 1, 2020, 4:45 p.m. OK PyPy 2 TESTS 60 280 8294400
85677294 _aLso D July 1, 2020, 2:57 p.m. OK PyPy 2 TESTS 60 343 8908800
85672194 knk_kei D July 1, 2020, 2:47 p.m. OK PyPy 3 TESTS 60 171 2764800
85661214 aberent D July 1, 2020, 2:27 p.m. OK PyPy 3 TESTS 60 171 2969600
85703315 Nifer D July 1, 2020, 5:09 p.m. OK PyPy 3 TESTS 60 171 3072000
85706671 gintoki_s D July 1, 2020, 5:40 p.m. OK PyPy 3 TESTS 60 171 3174400
85720970 otterPurva D July 1, 2020, 9:54 p.m. OK PyPy 3 TESTS 60 171 3276800
85666494 marcus.li D July 1, 2020, 2:36 p.m. OK PyPy 3 TESTS 60 171 3584000
85678142 Q.E.D D July 1, 2020, 2:59 p.m. OK PyPy 3 TESTS 60 186 2867200
85684393 srkvrm D July 1, 2020, 3:12 p.m. OK PyPy 3 TESTS 60 186 3584000
85709917 hpoirot D July 1, 2020, 6:18 p.m. OK PyPy 3 TESTS 60 186 3686400
85665681 smoke_bellew D July 1, 2020, 2:35 p.m. OK PyPy 3 TESTS 60 186 3686400
85713532 ap1008 D July 1, 2020, 7:08 p.m. OK Python 2 TESTS 60 171 0
85683760 mockingj D July 1, 2020, 3:11 p.m. OK Python 2 TESTS 60 187 0
85664075 nandarustam D July 1, 2020, 2:32 p.m. OK Python 2 TESTS 60 233 614400
85686553 BlackBear D July 1, 2020, 3:17 p.m. OK Python 3 TESTS 60 109 307200
85668482 ItayOtto D July 1, 2020, 2:40 p.m. OK Python 3 TESTS 60 109 307200
85703744 shareen7 D July 1, 2020, 5:12 p.m. OK Python 3 TESTS 60 124 0
85687479 doni69 D July 1, 2020, 3:19 p.m. OK Python 3 TESTS 60 124 0
85693546 kraspai D July 1, 2020, 3:31 p.m. OK Python 3 TESTS 60 124 307200
85692018 prathmesh1999 D July 1, 2020, 3:28 p.m. OK Python 3 TESTS 60 124 307200
85685137 taoboquan1 D July 1, 2020, 3:14 p.m. OK Python 3 TESTS 60 124 307200
85680066 Hiroshi.K D July 1, 2020, 3:03 p.m. OK Python 3 TESTS 60 124 307200
85737734 Khan17 D July 2, 2020, 5:15 a.m. OK Python 3 TESTS 60 139 614400
85691562 KA_Rma D July 1, 2020, 3:27 p.m. OK Python 3 TESTS 60 139 1024000
85665307 manta1130 D July 1, 2020, 2:34 p.m. OK Rust TESTS 60 46 512000
85668310 bqn D July 1, 2020, 2:40 p.m. OK Rust TESTS 60 77 512000

remove filters

Back to search problems