Codeforces Round 1056 (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
2155 Codeforces Round 1056 (Div. 2) FINISHED False 7200 16723523 Oct. 5, 2025, 4:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 16873 ) B Abraham's Great Escape PROGRAMMING constructive algorithms graphs

Abraham is a brave explorer who goes where no other programmer has gone before. For his next expedition, he plans to investigate a peculiar maze. He knows that the maze is an (n \times n) grid with an arrow in each cell that points in one of four directions: up, down, left and right. Abraham also knows that if he stands on an arrow, he will be forced to follow the arrows starting from that cell. Each arrow moves Abraham exactly (1) cell in the direction that it is pointing. If he reaches an arrow that points towards the outside of the maze, Abraham will escape the maze. Abraham doesn't know how the arrows are arranged, so he wants to plan for multiple scenarios. He tasks you with finding an arrangement of arrows in the grid such that there are exactly (k) starting cells from which he can escape the maze. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The only line of each test case contains two integers (n), (k) ((2 \le n \le 100), (0 \le k \le n^2)) — the size of the grid and the number of cells from which Abraham should be able to escape. It is guaranteed that the sum of (n^2) over all test cases does not exceed (10^5). For each test case, do one of the following: If there exists a grid satisfying the requirement, print YES and then print (n) lines with (n) characters in each line indicating the direction of the arrows. Each character should be one of U (up), R (right), L (left), or D (down). Otherwise, declare that the task is impossible by printing NO . If there are multiple solutions, print any of them. You can output the answer in any case (upper or lower). For example, the strings " yEs ", " yes ", " Yes ", and " YES " will be recognized as positive responses. In the first test case, no matter which cell Abraham stands in initially, he will eventually exit the maze as he will move upward s

Tutorials

Codeforces Round 1056 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
342163704 Harsh103 B Oct. 6, 2025, 6:04 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342163653 amrit003singh B Oct. 6, 2025, 6:04 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342163488 Shenyurou B Oct. 6, 2025, 6:02 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342163044 mayur_.17 B Oct. 6, 2025, 5:58 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342162990 altIdRaiwat B Oct. 6, 2025, 5:57 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342162631 Sanctimonious B Oct. 6, 2025, 5:55 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342162370 funky_Q B Oct. 6, 2025, 5:52 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342161695 Luuldag B Oct. 6, 2025, 5:46 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342161335 Gupto05 B Oct. 6, 2025, 5:42 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342161035 Ahmed_Crusader B Oct. 6, 2025, 5:39 a.m. OK C++17 (GCC 7-32) TESTS 10 46 0
342150016 sillyMistakes B Oct. 6, 2025, 3:26 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
342163528 ali_gator B Oct. 6, 2025, 6:02 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342163049 Wisealt B Oct. 6, 2025, 5:58 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342160973 Ali-Khatibi B Oct. 6, 2025, 5:39 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342159951 me_error B Oct. 6, 2025, 5:28 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342159358 visheshkumar18 B Oct. 6, 2025, 5:22 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342158992 arimakanaa B Oct. 6, 2025, 5:18 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342158957 kira_999 B Oct. 6, 2025, 5:17 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342158901 SATSKY_2025target_LGM B Oct. 6, 2025, 5:17 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342157500 Lenisel B Oct. 6, 2025, 5:02 a.m. OK C++20 (GCC 13-64) TESTS 10 46 0
342137366 Osmon38 B Oct. 5, 2025, 11:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 0
342139516 molongdadi B Oct. 6, 2025, 12:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 102400
342161024 deadlycoder82 B Oct. 6, 2025, 5:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 31 64204800
342163681 Airmongsity B Oct. 6, 2025, 6:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
342162732 aravrathi B Oct. 6, 2025, 5:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
342162636 Ahzzz B Oct. 6, 2025, 5:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
342162163 somnath910 B Oct. 6, 2025, 5:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
342161078 Code_Maker_only12 B Oct. 6, 2025, 5:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
342160965 atik_uwu B Oct. 6, 2025, 5:38 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
342160911 Krishna0803 B Oct. 6, 2025, 5:38 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 46 0
342110477 bhslyv B Oct. 5, 2025, 6:23 p.m. OK GNU C11 TESTS 10 62 102400
342154435 Syamantak1101 B Oct. 6, 2025, 4:23 a.m. OK GNU C11 TESTS 10 93 0
342149808 pranjalbaranwal304 B Oct. 6, 2025, 3:23 a.m. OK GNU C11 TESTS 10 359 0
342147568 KL2400031478 B Oct. 6, 2025, 2:54 a.m. OK GNU C11 TESTS 10 421 102400
342145185 Mr.Corgiboi B Oct. 6, 2025, 2:19 a.m. OK GNU C11 TESTS 10 421 102400
342161165 Dhyey_0075 B Oct. 6, 2025, 5:41 a.m. OK GNU C11 TESTS 10 436 102400
342111158 Sayantan_Hazra B Oct. 5, 2025, 6:24 p.m. OK GNU C11 TESTS 10 437 102400
342104780 fakerbaber B Oct. 5, 2025, 6:12 p.m. OK GNU C11 TESTS 10 467 204800
342112918 DYNAMiC69 B Oct. 5, 2025, 6:27 p.m. OK GNU C11 TESTS 10 468 102400
342111907 awesamm B Oct. 5, 2025, 6:26 p.m. OK GNU C11 TESTS 10 468 204800
342108223 gustt_ B Oct. 5, 2025, 6:19 p.m. OK Go TESTS 10 77 614400
342143238 densefeature B Oct. 6, 2025, 1:49 a.m. OK Go TESTS 10 155 409600
342161408 ccj123 B Oct. 6, 2025, 5:43 a.m. OK Java 21 TESTS 10 234 512000
342157141 mayurbhai B Oct. 6, 2025, 4:58 a.m. OK Java 21 TESTS 10 249 409600
342110646 sakshams7778 B Oct. 5, 2025, 6:23 p.m. OK Java 21 TESTS 10 249 1228800
342108241 winter262005 B Oct. 5, 2025, 6:19 p.m. OK Java 21 TESTS 10 249 1228800
342132515 me_shivendra01 B Oct. 5, 2025, 9:36 p.m. OK Java 21 TESTS 10 264 0
342105718 ShubhamChaudhary18 B Oct. 5, 2025, 6:14 p.m. OK Java 21 TESTS 10 265 409600
342125038 RockingMat B Oct. 5, 2025, 8:11 p.m. OK Java 21 TESTS 10 280 307200
342112063 gladius240 B Oct. 5, 2025, 6:26 p.m. OK Java 21 TESTS 10 280 512000
342149554 harsha4p28 B Oct. 6, 2025, 3:20 a.m. OK Java 21 TESTS 10 280 1536000
342142492 mastacoda B Oct. 6, 2025, 1:37 a.m. OK Java 21 TESTS 10 281 409600
342129129 suntansoker B Oct. 5, 2025, 8:49 p.m. OK Java 8 TESTS 10 139 0
342127471 suntansoker B Oct. 5, 2025, 8:32 p.m. OK Java 8 TESTS 10 156 0
342125523 Eslam_Ahmed B Oct. 5, 2025, 8:15 p.m. OK Java 8 TESTS 10 202 0
342112380 pannalapranay1406 B Oct. 5, 2025, 6:27 p.m. OK Java 8 TESTS 10 218 0
342162023 keshavraj.iitkgp B Oct. 6, 2025, 5:49 a.m. OK Java 8 TESTS 10 296 0
342110233 NithishReddyK B Oct. 5, 2025, 6:22 p.m. OK Java 8 TESTS 10 296 0
342163510 yashgupta110 B Oct. 6, 2025, 6:02 a.m. OK Java 8 TESTS 10 312 0
342153144 rushi1105 B Oct. 6, 2025, 4:06 a.m. OK Java 8 TESTS 10 327 0
342115033 asif.mohamed1616 B Oct. 5, 2025, 6:31 p.m. OK Java 8 TESTS 10 343 0
342160279 saiashish9 B Oct. 6, 2025, 5:31 a.m. OK Java 8 TESTS 10 359 0
342129573 Homka_666 B Oct. 5, 2025, 8:53 p.m. OK Node.js TESTS 10 171 7270400
342153381 tuffknuckles B Oct. 6, 2025, 4:10 a.m. OK Node.js TESTS 10 343 20070400
342141193 DoryperPevin B Oct. 6, 2025, 1:13 a.m. OK PyPy 3 TESTS 10 202 6144000
342132142 BlackFlag313 B Oct. 5, 2025, 9:29 p.m. OK PyPy 3 TESTS 10 202 6860800
342160180 JavohirHasanov B Oct. 6, 2025, 5:30 a.m. OK PyPy 3 TESTS 10 218 4812800
342160106 JavohirHasanov B Oct. 6, 2025, 5:30 a.m. OK PyPy 3 TESTS 10 218 4812800
342129683 idhalappa B Oct. 5, 2025, 8:54 p.m. OK PyPy 3 TESTS 10 218 6348800
342109773 belote44 B Oct. 5, 2025, 6:22 p.m. OK PyPy 3 TESTS 10 218 6553600
342112376 GeorgyX B Oct. 5, 2025, 6:27 p.m. OK PyPy 3 TESTS 10 343 9318400
342144456 bpdolson B Oct. 6, 2025, 2:08 a.m. OK PyPy 3 TESTS 10 359 6758400
342134142 qs-1 B Oct. 5, 2025, 10:08 p.m. OK PyPy 3-64 TESTS 10 93 3072000
342107888 Atopolev B Oct. 5, 2025, 6:18 p.m. OK PyPy 3-64 TESTS 10 108 3379200
342159392 kamio-misuzu B Oct. 6, 2025, 5:22 a.m. OK PyPy 3-64 TESTS 10 124 3584000
342133336 roshini.damodaran B Oct. 5, 2025, 9:52 p.m. OK PyPy 3-64 TESTS 10 124 3584000
342160364 vikgeniX B Oct. 6, 2025, 5:32 a.m. OK PyPy 3-64 TESTS 10 124 3686400
342156249 gardengnome B Oct. 6, 2025, 4:48 a.m. OK PyPy 3-64 TESTS 10 139 2457600
342125651 RobinFromTheHood B Oct. 5, 2025, 8:16 p.m. OK PyPy 3-64 TESTS 10 139 4300800
342157374 thevivekpandey B Oct. 6, 2025, 5:01 a.m. OK PyPy 3-64 TESTS 10 140 3481600
342109818 rishabhavvari B Oct. 5, 2025, 6:22 p.m. OK PyPy 3-64 TESTS 10 140 3584000
342134468 defaultedplayer B Oct. 5, 2025, 10:15 p.m. OK PyPy 3-64 TESTS 10 140 5120000
342127228 kostik37 B Oct. 5, 2025, 8:30 p.m. OK Python 3 TESTS 10 77 0
342108691 lastlight_4 B Oct. 5, 2025, 6:20 p.m. OK Python 3 TESTS 10 77 307200
342148824 rohithkarthikeya48851 B Oct. 6, 2025, 3:10 a.m. OK Python 3 TESTS 10 78 409600
342104775 ramcharan_008 B Oct. 5, 2025, 6:12 p.m. OK Python 3 TESTS 10 78 512000
342157800 rabbit301103 B Oct. 6, 2025, 5:05 a.m. OK Python 3 TESTS 10 92 409600
342163879 Jaijnuak B Oct. 6, 2025, 6:06 a.m. OK Python 3 TESTS 10 93 0
342156806 eugalt B Oct. 6, 2025, 4:55 a.m. OK Python 3 TESTS 10 93 204800
342111337 NOIR_2004 B Oct. 5, 2025, 6:25 p.m. OK Python 3 TESTS 10 93 204800
342154789 _.ayush18 B Oct. 6, 2025, 4:28 a.m. OK Python 3 TESTS 10 93 307200
342137417 WaterMonkey30 B Oct. 5, 2025, 11:35 p.m. OK Python 3 TESTS 10 108 0

remove filters

Back to search problems