Codeforces Round 939 (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
1956 Codeforces Round 939 (Div. 2) FINISHED False 7200 24161063 April 13, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 13390 ) C Nene's Magical Matrix PROGRAMMING constructive algorithms greedy math

B"The magical girl Nene has an n x n matrix a filled with zeroes. The j -th element of the i -th row of matrix a is denoted as a_{i, j} . She can perform operations of the following two types with this matrix: Nene wants to maximize the sum of all the numbers in the matrix sum limits_{i=1}^{n} sum limits_{j=1}^{n}a_{i,j} . She asks you to find the way to perform the operations so that this sum is maximized. As she doesn't want to make too many operations, you should provide a solution with no more than 2n operations. A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 appears twice in the array), and [1,3,4] is also not a permutation ( n=3 but there is 4 in the array). Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 500 ). The description of test cases follows. The only line of each test case contains a single integer n ( 1 <= n <= 500 ) -- the size of the matrix a . It is guaranteed that the sum of n^2 over all test cases does not exceed 5 cdot 10^5 . For each test case, in the first line output two integers s and m ( 0 <= q m <= q 2n ) -- the maximum sum of the numbers in the matrix and the number of operations in your solution. In the k -th of the next m lines output the description of the k -th operation: Note that you don't need to minimize the number of operations used, you only should use no more than 2n operations. It can be shown that the maximum possible sum can always be obtained in no more than 2n operations. In the first test case, the maximum sum s=1 can be obtained in 1 operation by setting a_{1, 1}:=1 . In the second test case, the maximum sum s=7$"...

Tutorials

[Editorial] Codeforces Round 939 (Div. 2)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
256549944 FanFeng233 C April 13, 2024, 6:18 p.m. OK C++14 (GCC 6-32) TESTS 15 61 102400
256562465 w_izard C April 13, 2024, 8:15 p.m. OK C++14 (GCC 6-32) TESTS 15 62 102400
256550249 Denny.Cui C April 13, 2024, 6:20 p.m. OK C++14 (GCC 6-32) TESTS 15 62 102400
256534214 theOceanMoon C April 13, 2024, 4:26 p.m. OK C++14 (GCC 6-32) TESTS 15 77 102400
256555406 NICK_04 C April 13, 2024, 7:01 p.m. OK C++14 (GCC 6-32) TESTS 15 78 0
256570306 coder1073 C April 13, 2024, 10:04 p.m. OK C++14 (GCC 6-32) TESTS 15 124 0
256547897 _Shashanksingh C April 13, 2024, 6:03 p.m. OK C++14 (GCC 6-32) TESTS 15 124 0
256591024 Krish_Chothani C April 14, 2024, 4:37 a.m. OK C++14 (GCC 6-32) TESTS 15 124 102400
256588052 qwaftex C April 14, 2024, 3:49 a.m. OK C++14 (GCC 6-32) TESTS 15 124 102400
256586942 smart_kai C April 14, 2024, 3:31 a.m. OK C++14 (GCC 6-32) TESTS 15 124 102400
256586916 vg18 C April 14, 2024, 3:30 a.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256584908 chandu1479 C April 14, 2024, 2:55 a.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256577177 vkuri C April 14, 2024, 12:31 a.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256575437 aryanartist30 C April 13, 2024, 11:52 p.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256575242 ruchit2801 C April 13, 2024, 11:47 p.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256559046 Crusader_X C April 13, 2024, 7:38 p.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256555657 MayaZayn C April 13, 2024, 7:03 p.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256546713 Devansh_0319 C April 13, 2024, 5:55 p.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256546701 QRQRQR C April 13, 2024, 5:55 p.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256543147 AdityaB02 C April 13, 2024, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 15 62 0
256582071 MagedSayed C April 14, 2024, 2:04 a.m. OK C++20 (GCC 13-64) TESTS 15 46 102400
256550483 n.kalwan C April 13, 2024, 6:22 p.m. OK C++20 (GCC 13-64) TESTS 15 61 102400
256596029 wwwa233 C April 14, 2024, 5:43 a.m. OK C++20 (GCC 13-64) TESTS 15 62 0
256583825 zeferis C April 14, 2024, 2:35 a.m. OK C++20 (GCC 13-64) TESTS 15 62 0
256556720 ankitkundu837 C April 13, 2024, 7:13 p.m. OK C++20 (GCC 13-64) TESTS 15 62 0
256534993 kunal_thakur_ C April 13, 2024, 4:28 p.m. OK C++20 (GCC 13-64) TESTS 15 62 0
256584878 Murat311 C April 14, 2024, 2:55 a.m. OK C++20 (GCC 13-64) TESTS 15 62 102400
256548524 fry10me C April 13, 2024, 6:08 p.m. OK C++20 (GCC 13-64) TESTS 15 62 102400
256575600 Youssef_Elwazzan C April 13, 2024, 11:55 p.m. OK C++20 (GCC 13-64) TESTS 15 62 614400
256590427 M-Manas-s C April 14, 2024, 4:27 a.m. OK C++20 (GCC 13-64) TESTS 15 77 0
256547158 ruban C April 13, 2024, 5:58 p.m. OK Delphi TESTS 15 140 102400
256560152 NenadDapic C April 13, 2024, 7:50 p.m. OK FPC TESTS 15 1109 0
256550640 baezilisK C April 13, 2024, 6:23 p.m. OK GNU C11 TESTS 15 202 102400
256535801 InsaneLaksh C April 13, 2024, 4:30 p.m. OK GNU C11 TESTS 15 234 102400
256587583 Specter_TheUnchained C April 14, 2024, 3:41 a.m. OK Go TESTS 15 124 36147200
256587353 keutoi C April 14, 2024, 3:37 a.m. OK Haskell TESTS 15 1015 0
256530792 ferfer C April 13, 2024, 4:19 p.m. OK Java 21 TESTS 15 311 2150400
256578444 soutRian C April 14, 2024, 12:59 a.m. OK Java 21 TESTS 15 311 6451200
256585244 priyaroy3370 C April 14, 2024, 3:01 a.m. OK Java 21 TESTS 15 312 7782400
256546025 venom246800 C April 13, 2024, 5:50 p.m. OK Java 21 TESTS 15 312 13004800
256532958 sary-bala C April 13, 2024, 4:23 p.m. OK Java 21 TESTS 15 327 1228800
256556912 waeldgheim C April 13, 2024, 7:15 p.m. OK Java 21 TESTS 15 327 1331200
256588177 pathakbaba C April 14, 2024, 3:50 a.m. OK Java 21 TESTS 15 328 1228800
256546342 satyamt04 C April 13, 2024, 5:52 p.m. OK Java 21 TESTS 15 343 1228800
256546066 xobe19 C April 13, 2024, 5:50 p.m. OK Java 21 TESTS 15 343 6451200
256548242 coder0687 C April 13, 2024, 6:05 p.m. OK Java 21 TESTS 15 343 6553600
256579203 hanekaeru C April 14, 2024, 1:13 a.m. OK Java 8 TESTS 15 187 0
256571399 kevinliu__ C April 13, 2024, 10:26 p.m. OK Java 8 TESTS 15 187 0
256579014 hanekaeru C April 14, 2024, 1:09 a.m. OK Java 8 TESTS 15 202 0
256579110 hanekaeru C April 14, 2024, 1:11 a.m. OK Java 8 TESTS 15 218 0
256545156 Mr_A C April 13, 2024, 5:45 p.m. OK Java 8 TESTS 15 218 0
256551547 gagan_6730 C April 13, 2024, 6:29 p.m. OK Java 8 TESTS 15 218 15667200
256578496 alibaba C April 14, 2024, 1 a.m. OK Java 8 TESTS 15 234 0
256587357 aditya888 C April 14, 2024, 3:38 a.m. OK Java 8 TESTS 15 249 0
256562092 deepak_v2003 C April 13, 2024, 8:11 p.m. OK Java 8 TESTS 15 249 0
256597495 kasiru_69 C April 14, 2024, 5:59 a.m. OK Java 8 TESTS 15 249 5427200
256544255 xblwyc_hardcore C April 13, 2024, 5:39 p.m. OK Kotlin 1.9 TESTS 15 264 307200
256568122 aayush.mishra C April 13, 2024, 9:29 p.m. OK Kotlin 1.9 TESTS 15 296 204800
256538906 Aniketrax C April 13, 2024, 4:34 p.m. OK Kotlin 1.9 TESTS 15 1593 0
256568088 aayush.mishra C April 13, 2024, 9:28 p.m. OK Kotlin 1.9 TESTS 15 1671 0
256538472 ub_01 C April 13, 2024, 4:34 p.m. OK Perl TESTS 15 296 11878400
256554270 maximzasorin C April 13, 2024, 6:51 p.m. OK PHP TESTS 15 187 31539200
256533424 aditya_coder07 C April 13, 2024, 4:25 p.m. OK PHP TESTS 15 999 307200
256573450 bihar_ke_lala C April 13, 2024, 11:08 p.m. OK PyPy 3 TESTS 15 374 7065600
256582375 Slata C April 14, 2024, 2:10 a.m. OK PyPy 3 TESTS 15 577 11059200
256562088 sauravagtl C April 13, 2024, 8:11 p.m. OK PyPy 3 TESTS 15 578 10342400
256594958 lo_krlo_baatt C April 14, 2024, 5:31 a.m. OK PyPy 3 TESTS 15 593 11264000
256535838 Yasho_ham C April 13, 2024, 4:30 p.m. OK PyPy 3 TESTS 15 640 10752000
256529296 Kangroo C April 13, 2024, 4:15 p.m. OK PyPy 3 TESTS 15 718 10752000
256533644 new.bie C April 13, 2024, 4:25 p.m. OK PyPy 3 TESTS 15 1062 11059200
256533086 kimsg125 C April 13, 2024, 4:24 p.m. OK PyPy 3 TESTS 15 1109 11468800
256577663 amitjoshi24 C April 14, 2024, 12:41 a.m. OK PyPy 3-64 TESTS 15 93 11673600
256589581 hello_world0421 C April 14, 2024, 4:13 a.m. OK PyPy 3-64 TESTS 15 108 19353600
256549495 chipp C April 13, 2024, 6:14 p.m. OK PyPy 3-64 TESTS 15 124 6246400
256545572 jamez_is_cool C April 13, 2024, 5:47 p.m. OK PyPy 3-64 TESTS 15 124 6553600
256593219 yertugan06 C April 14, 2024, 5:09 a.m. OK PyPy 3-64 TESTS 15 139 8192000
256585791 dragonier C April 14, 2024, 3:11 a.m. OK PyPy 3-64 TESTS 15 140 7475200
256572965 Westin_sheep C April 13, 2024, 10:58 p.m. OK PyPy 3-64 TESTS 15 140 9113600
256572632 Noureldin C April 13, 2024, 10:50 p.m. OK PyPy 3-64 TESTS 15 140 11264000
256558254 keeyann C April 13, 2024, 7:29 p.m. OK PyPy 3-64 TESTS 15 155 8806400
256596413 vrksf C April 14, 2024, 5:47 a.m. OK PyPy 3-64 TESTS 15 155 9113600
256546235 mihajlovskijr C April 13, 2024, 5:51 p.m. OK Python 3 TESTS 15 108 0
256591307 ireallydontknow C April 14, 2024, 4:41 a.m. OK Python 3 TESTS 15 124 0
256555056 OLOGY C April 13, 2024, 6:58 p.m. OK Python 3 TESTS 15 249 6144000
256544907 AI_ C April 13, 2024, 5:43 p.m. OK Python 3 TESTS 15 281 2048000
256544012 OLOGY C April 13, 2024, 5:38 p.m. OK Python 3 TESTS 15 312 6041600
256536705 craisin C April 13, 2024, 4:31 p.m. OK Python 3 TESTS 15 343 1945600
256549233 daveshub C April 13, 2024, 6:13 p.m. OK Python 3 TESTS 15 827 102400
256577694 r-tron18 C April 14, 2024, 12:42 a.m. OK Python 3 TESTS 15 858 0
256553687 Om_Singh_ C April 13, 2024, 6:46 p.m. OK Python 3 TESTS 15 874 204800
256550728 sayedgamall C April 13, 2024, 6:23 p.m. OK Python 3 TESTS 15 905 102400
256538627 sugar.nova C April 13, 2024, 4:34 p.m. OK Ruby 3 TESTS 15 734 4710400
256569670 vstiff C April 13, 2024, 9:53 p.m. OK Rust 2021 TESTS 15 46 102400
256537771 udaybindal C April 13, 2024, 4:33 p.m. OK Rust 2021 TESTS 15 124 102400
256530470 harkd0001 C April 13, 2024, 4:18 p.m. OK Rust 2021 TESTS 15 171 3686400
256537333 Kalia_H C April 13, 2024, 4:32 p.m. OK Scala TESTS 15 1968 716800

remove filters

Back to search problems