Codeforces Round 896 (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
1868 Codeforces Round 896 (Div. 1) FINISHED False 9000 42825263 Sept. 10, 2023, 2:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 12317 ) A Fill in the Matrix PROGRAMMING constructive algorithms implementation

B'There is an empty matrix M of size n x m . Zhongkao examination is over, and Daniel would like to do some puzzle games. He is going to fill in the matrix M using permutations of length m . That is, each row of M must be a permutation of length m^ dagger . Define the value of the i -th column in M as v_i= operatorname{MEX}(M_{1,i},M_{2,i}, ldots,M_{n,i})^ ddagger . Since Daniel likes diversity, the beauty of M is s= operatorname{MEX}(v_1,v_2, cdots,v_m) . You have to help Daniel fill in the matrix M and maximize its beauty. ^ dagger A permutation of length m is an array consisting of m distinct integers from 0 to m-1 in arbitrary order. For example, [1,2,0,4,3] is a permutation, but [0,1,1] is not a permutation ( 1 appears twice in the array), and [0,1,3] is also not a permutation ( m-1=2 but there is 3 in the array). ^ ddagger The operatorname{MEX} of an array is the smallest non-negative integer that does not belong to the array. For example, operatorname{MEX}(2,2,1)=0 because 0 does not belong to the array, and operatorname{MEX}(0,3,1,2)=4 because 0 , 1 , 2 and 3 appear in the array, but 4 does not. The first line of input contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. The description of test cases follows. The only line of each test case contains two integers n and m ( 1 <= n,m <= 2 cdot 10^5 ) -- the size of the matrix. It is guaranteed that the sum of n cdot m over all test cases does not exceed 2 cdot 10^5 . For each test case, in the first line output a single integer -- the maximum beauty of M . Then output the matrix M of size n x m -- the matrix you find. If there are multiple solutions, you may output any of them. In the first test case: Therefore, s= operatorna'...

Tutorials

Codeforces Round 896 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
222737339 mban259 A Sept. 10, 2023, 2:24 p.m. OK C# 10 TESTS 28 77 20787200
222730759 KumaTachiRen A Sept. 10, 2023, 2:15 p.m. OK C# 8 TESTS 28 155 10854400
222826870 bobby_gan A Sept. 10, 2023, 8:05 p.m. OK Clang++17 Diagnostics TESTS 28 623 0
222732456 Gassa A Sept. 10, 2023, 2:17 p.m. OK D TESTS 28 140 13926400
222729414 hos.lyric A Sept. 10, 2023, 2:13 p.m. OK D TESTS 28 187 13824000
222845847 vjudge3 A Sept. 11, 2023, 2:47 a.m. OK GNU C++14 TESTS 28 31 0
222838338 XZC__Bobby A Sept. 11, 2023, 12:04 a.m. OK GNU C++14 TESTS 28 31 0
222747342 hzt1 A Sept. 10, 2023, 2:39 p.m. OK GNU C++14 TESTS 28 31 0
222740456 meteor_shower A Sept. 10, 2023, 2:28 p.m. OK GNU C++14 TESTS 28 31 0
222736391 harinboy A Sept. 10, 2023, 2:22 p.m. OK GNU C++14 TESTS 28 31 0
222734431 prokulijander A Sept. 10, 2023, 2:20 p.m. OK GNU C++14 TESTS 28 31 0
222733223 Sukwants A Sept. 10, 2023, 2:18 p.m. OK GNU C++14 TESTS 28 31 0
222731811 cfhj A Sept. 10, 2023, 2:16 p.m. OK GNU C++14 TESTS 28 31 0
222730417 SpadeA261 A Sept. 10, 2023, 2:15 p.m. OK GNU C++14 TESTS 28 31 0
222730306 using233 A Sept. 10, 2023, 2:15 p.m. OK GNU C++14 TESTS 28 31 0
222835021 Juve45 A Sept. 10, 2023, 10:28 p.m. OK GNU C++17 TESTS 28 31 0
222744606 patou A Sept. 10, 2023, 2:35 p.m. OK GNU C++17 TESTS 28 31 0
222743461 _Rebellion A Sept. 10, 2023, 2:33 p.m. OK GNU C++17 TESTS 28 31 0
222740843 hylhyl A Sept. 10, 2023, 2:29 p.m. OK GNU C++17 TESTS 28 31 0
222737977 CepryH9 A Sept. 10, 2023, 2:25 p.m. OK GNU C++17 TESTS 28 31 0
222736844 Road_to_8a A Sept. 10, 2023, 2:23 p.m. OK GNU C++17 TESTS 28 31 0
222735928 iccodly A Sept. 10, 2023, 2:22 p.m. OK GNU C++17 TESTS 28 31 0
222735422 Frank_DD A Sept. 10, 2023, 2:21 p.m. OK GNU C++17 TESTS 28 31 0
222735043 Nson A Sept. 10, 2023, 2:21 p.m. OK GNU C++17 TESTS 28 31 0
222734791 _bLIC_ A Sept. 10, 2023, 2:20 p.m. OK GNU C++17 TESTS 28 31 0
222855973 Alex_Wei A Sept. 11, 2023, 5:41 a.m. OK GNU C++17 (64) TESTS 29 31 0
222845626 iamttm A Sept. 11, 2023, 2:43 a.m. OK GNU C++17 (64) TESTS 28 31 0
222839326 Misono_Mika A Sept. 11, 2023, 12:29 a.m. OK GNU C++17 (64) TESTS 28 31 0
222827410 roshanraj1543 A Sept. 10, 2023, 8:12 p.m. OK GNU C++17 (64) TESTS 28 31 0
222743269 ekatsim A Sept. 10, 2023, 2:32 p.m. OK GNU C++17 (64) TESTS 28 31 0
222742954 DLUT_Zeratul A Sept. 10, 2023, 2:32 p.m. OK GNU C++17 (64) TESTS 28 31 0
222741425 Raiden A Sept. 10, 2023, 2:30 p.m. OK GNU C++17 (64) TESTS 28 31 0
222739794 luanmenglei A Sept. 10, 2023, 2:27 p.m. OK GNU C++17 (64) TESTS 28 31 0
222739280 HuaJun A Sept. 10, 2023, 2:26 p.m. OK GNU C++17 (64) TESTS 28 31 0
222739267 apostoldaniel854 A Sept. 10, 2023, 2:26 p.m. OK GNU C++17 (64) TESTS 28 31 0
222736567 lsantire A Sept. 10, 2023, 2:23 p.m. OK GNU C++20 (64) TESTS 28 15 1638400
222746880 kehKeLenge A Sept. 10, 2023, 2:38 p.m. OK GNU C++20 (64) TESTS 28 30 0
222732183 unlimited_bezdarnost A Sept. 10, 2023, 2:17 p.m. OK GNU C++20 (64) TESTS 28 30 0
222727879 atodo A Sept. 10, 2023, 2:11 p.m. OK GNU C++20 (64) TESTS 28 30 819200
222733405 KDVinit A Sept. 10, 2023, 2:18 p.m. OK GNU C++20 (64) TESTS 28 30 1638400
222750951 hackerbhaiya A Sept. 10, 2023, 2:45 p.m. OK GNU C++20 (64) TESTS 28 30 1843200
222739403 red-stone A Sept. 10, 2023, 2:27 p.m. OK GNU C++20 (64) TESTS 28 30 3686400
222854577 JYJin A Sept. 11, 2023, 5:20 a.m. OK GNU C++20 (64) TESTS 29 31 0
222847417 Msstt A Sept. 11, 2023, 3:19 a.m. OK GNU C++20 (64) TESTS 29 31 0
222843699 Shoeib A Sept. 11, 2023, 2:05 a.m. OK GNU C++20 (64) TESTS 28 31 0
222747823 profchi A Sept. 10, 2023, 2:39 p.m. OK Java 11 TESTS 28 233 7065600
222739732 lemon_codes A Sept. 10, 2023, 2:27 p.m. OK Java 17 TESTS 28 748 307200
222853087 upadhyaytushar552 A Sept. 11, 2023, 5 a.m. OK Java 17 TESTS 29 1107 1331200
222830488 codeanand17 A Sept. 10, 2023, 8:55 p.m. OK Java 17 TESTS 28 1154 1228800
222744174 yvbf A Sept. 10, 2023, 2:34 p.m. OK Java 8 TESTS 28 140 0
222734572 rowechen A Sept. 10, 2023, 2:20 p.m. OK Java 8 TESTS 28 140 0
222736595 RMA-NB A Sept. 10, 2023, 2:23 p.m. OK Java 8 TESTS 28 155 0
222749881 cc4414 A Sept. 10, 2023, 2:43 p.m. OK Java 8 TESTS 28 171 0
222736793 golions A Sept. 10, 2023, 2:23 p.m. OK Java 8 TESTS 28 171 3379200
222816220 Sumitsingh7 A Sept. 10, 2023, 6:16 p.m. OK Java 8 TESTS 28 1356 7372800
222728361 FastFreeTask A Sept. 10, 2023, 2:12 p.m. OK Kotlin 1.6 TESTS 28 280 3379200
222738673 Tlatoani A Sept. 10, 2023, 2:25 p.m. OK Kotlin 1.6 TESTS 28 295 5222400
222756934 Timonnable A Sept. 10, 2023, 2:55 p.m. OK MS C++ 2017 TESTS 28 140 5632000
222766128 bcollet A Sept. 10, 2023, 3:12 p.m. OK PyPy 2 TESTS 28 156 22220800
222739273 misorin A Sept. 10, 2023, 2:26 p.m. OK PyPy 3 TESTS 28 202 21606400
222732727 SPD_9X2 A Sept. 10, 2023, 2:18 p.m. OK PyPy 3 TESTS 28 358 27443200
222737518 yupooh A Sept. 10, 2023, 2:24 p.m. OK PyPy 3-64 TESTS 28 171 14131200
222738904 tamato A Sept. 10, 2023, 2:26 p.m. OK PyPy 3-64 TESTS 28 202 14131200
222738850 Maruzensky A Sept. 10, 2023, 2:26 p.m. OK PyPy 3-64 TESTS 28 202 14438400
222763830 chinerist A Sept. 10, 2023, 3:07 p.m. OK PyPy 3-64 TESTS 28 218 15974400
222734894 jatloe A Sept. 10, 2023, 2:20 p.m. OK PyPy 3-64 TESTS 28 218 21913600
222744140 skhan_org A Sept. 10, 2023, 2:34 p.m. OK PyPy 3-64 TESTS 28 218 27545600
222727527 bronze_coder A Sept. 10, 2023, 2:11 p.m. OK PyPy 3-64 TESTS 28 233 14131200
222733239 thewaxmango A Sept. 10, 2023, 2:18 p.m. OK PyPy 3-64 TESTS 28 233 28057600
222740698 codicon A Sept. 10, 2023, 2:28 p.m. OK PyPy 3-64 TESTS 28 233 35635200
222732906 whatshisbucket A Sept. 10, 2023, 2:18 p.m. OK PyPy 3-64 TESTS 28 248 28160000
222733750 Jimanbanashi A Sept. 10, 2023, 2:19 p.m. OK Python 2 TESTS 28 217 14848000
222740471 shade34 A Sept. 10, 2023, 2:28 p.m. OK Python 3 TESTS 28 311 25292800
222810390 dsanurag520 A Sept. 10, 2023, 5:32 p.m. OK Python 3 TESTS 28 483 13926400
222736523 WaterColor2037 A Sept. 10, 2023, 2:23 p.m. OK Rust 2021 TESTS 28 1419 0

remove filters

Back to search problems