Codeforces Round 720 (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
1521 Codeforces Round 720 (Div. 2) FINISHED False 8100 116781863 May 7, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 683 ) E Nastia and a Beautiful Matrix PROGRAMMING binary search constructive algorithms greedy math

B"You like numbers, don't you? Nastia has a lot of numbers and she wants to share them with you! Isn't it amazing? Let a_i be how many numbers i ( 1 <= i <= k ) you have. An n x n matrix is called beautiful if it contains all the numbers you have, and for each 2 x 2 submatrix of the original matrix is satisfied: Make a beautiful matrix of minimum size. The first line contains a single integer t ( 1 <= t <= 10 ,000 ) -- the number of test cases. The first line of each test case contains 2 integers m and k ( 1 <= m, k <= 10^5 ) -- how many numbers Nastia gave you and the length of the array a , respectively. The second line of each test case contains k integers a_1, a_2, ldots, a_{k} ( 0 <= a_i <= m , a_1 + a_2 + ldots + a_{k} = m ), where a_i is how many numbers i you have. It's guaranteed that the sum of m and k in one test doesn't exceed 2 cdot 10^5 . For each t test case print a single integer n -- the size of the beautiful matrix. In the next n lines print n integers b_{i, j} ( 0 <= b_{i, j} <= k ; if position is empty, print b_{i, j} = 0 ) -- the beautiful matrix b you made up. Note that 0 in this problem represents a blank, not a number. Examples of possible answers for the first test case: begin{array}{cc} 1 & 1 4 & 0 end{array} hspace{0,5cm} begin{array}{cc} 1 & 4 1 & 0 end{array} hspace{0,5cm} begin{array}{cc} 4 & 0 1 & 1 end{array} Examples of not beautiful matrices for the first test case: begin{array}{cc} 1 & 0 4 & 1 end{array} hspace{0,5cm} begin{array}{cc} 4 & 1 7 & 1 end{array} hspace{0,5cm} begin{array}{cc} 1 & 0 4 & 0 end{array} The example of the not beautiful matrix for the second test case: begin{array}{cc} 3 & 4 & 0 & 2 & 2 3 & 2 & 3 & 3 & 0 0 & 1 & 0 & 0 & 0 3 & 0 & "...

Tutorials

90477

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
115623310 rainboy E May 7, 2021, 5:49 p.m. OK GNU C11 TESTS 62 1387 8089600
115633268 fishcathu. E May 7, 2021, 7:39 p.m. OK GNU C++11 TESTS 62 46 5836800
115633108 fishcathu. E May 7, 2021, 7:36 p.m. OK GNU C++11 TESTS 62 46 5836800
115649428 Phosphorus E May 8, 2021, 1:20 a.m. OK GNU C++11 TESTS 62 109 10956800
115661258 AC-Evil E May 8, 2021, 4:55 a.m. OK GNU C++11 TESTS 62 171 9523200
115617088 De_sl E May 7, 2021, 4:46 p.m. OK GNU C++14 TESTS 62 109 8192000
115641730 AgReB E May 7, 2021, 9:38 p.m. OK GNU C++17 TESTS 62 77 8601600
115637457 PrideBlack E May 7, 2021, 8:32 p.m. OK GNU C++17 TESTS 62 93 5324800
115616048 Ari E May 7, 2021, 4:44 p.m. OK GNU C++17 TESTS 62 93 9011200
115625925 racsosabe E May 7, 2021, 6:10 p.m. OK GNU C++17 TESTS 62 93 9625600
115648861 Cirno_9baka E May 8, 2021, 1:04 a.m. OK GNU C++17 TESTS 62 93 15872000
115616904 hhhhxc E May 7, 2021, 4:46 p.m. OK GNU C++17 TESTS 62 93 40857600
115618659 BigBag E May 7, 2021, 4:49 p.m. OK GNU C++17 TESTS 62 108 7884800
115660824 Theo830 E May 8, 2021, 4:49 a.m. OK GNU C++17 TESTS 62 124 8806400
115633814 6945932016PhongNT E May 7, 2021, 7:47 p.m. OK GNU C++17 TESTS 62 139 19148800
115641640 achi_basadzishvili E May 7, 2021, 9:36 p.m. OK GNU C++17 TESTS 62 139 52019200
115648144 LayCurse E May 8, 2021, 12:40 a.m. OK GNU C++17 (64) TESTS 62 46 109056000
115648559 LayCurse E May 8, 2021, 12:54 a.m. OK GNU C++17 (64) TESTS 62 46 109056000
115646831 wty2016 E May 7, 2021, 11:50 p.m. OK GNU C++17 (64) TESTS 62 61 14438400
115621592 12tqian E May 7, 2021, 5:39 p.m. OK GNU C++17 (64) TESTS 62 62 9216000
115632380 lsantire E May 7, 2021, 7:26 p.m. OK GNU C++17 (64) TESTS 62 77 5632000
115651526 izlyforever E May 8, 2021, 2:09 a.m. OK GNU C++17 (64) TESTS 62 77 6041600
115623488 MateoCV E May 7, 2021, 5:51 p.m. OK GNU C++17 (64) TESTS 62 77 11980800
115647428 aryanc403 E May 8, 2021, 12:14 a.m. OK GNU C++17 (64) TESTS 62 77 15257600
115616324 Monazo1997 E May 7, 2021, 4:45 p.m. OK GNU C++17 (64) TESTS 62 93 9830400
115618247 neko_nyaaaaaaaaaaaaaaaaa E May 7, 2021, 4:48 p.m. OK GNU C++17 (64) TESTS 62 93 15052800
115656824 PetrNguyen E May 8, 2021, 3:45 a.m. OK Java 11 TESTS 62 311 100249600
115632658 PetrNguyen E May 7, 2021, 7:30 p.m. OK Java 11 TESTS 62 327 100249600
115632767 PetrNguyen E May 7, 2021, 7:31 p.m. OK Java 11 TESTS 62 358 28569600
115658425 sh1194 E May 8, 2021, 4:12 a.m. OK Python 3 TESTS 62 717 14848000
115658309 sh1194 E May 8, 2021, 4:10 a.m. OK Python 3 TESTS 62 717 14848000
115658496 sh1194 E May 8, 2021, 4:13 a.m. OK Python 3 TESTS 62 810 16384000
115658622 sh1194 E May 8, 2021, 4:15 a.m. OK Python 3 TESTS 62 826 16588800

remove filters

Back to search problems