Educational Codeforces Round 179 (Rated for 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
2111 Educational Codeforces Round 179 (Rated for Div. 2) FINISHED False 7200 27444323 June 3, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1400 ) F Puzzle PROGRAMMING brute force constructive algorithms greedy math

You have been gifted a puzzle, where each piece of this puzzle is a square with a side length of one. You can glue any picture onto this puzzle, cut it, and obtain an almost ordinary jigsaw puzzle. Your friend is an avid mathematician, so he suggested you consider the following problem. Is it possible to arrange the puzzle pieces in such a way that the following conditions are met: the pieces are aligned parallel to the coordinate axes; the pieces do not overlap each other; all pieces form a single connected component (i.e., there exists a path from each piece to every other piece along the pieces, where each two consecutive pieces share a side); the ratio of the perimeter of this component to the area of this component equals (\frac{p}{s}); the number of pieces used does not exceed (50\,000). Can you handle it? Each test consists of several test cases. The first line contains a single integer (t) ((1 \le t \le 10)) — the number of test cases. The description of the test cases follows. The only line of each test case contains two integers (p) and (s) ((1 \le p, s \le 50)). For each test case: if it is impossible to arrange the pieces as described above, output a single integer (-1); otherwise, in the first line output a single integer (k) ((1 \le k \le 50\,000)), and then in (k) lines output the coordinates of the pieces: each line should contain two integers (x_{i}) and (y_{i}) ((-10^{9} \le x_{i}, y_{i} \le 10^{9})). If there are multiple suitable arrangements of the pieces, output any of them. In the first test case of the first test, the figure may look like this: In the second test, the figures look like this: Note that the internal perimeter is also taken into account!

Tutorials

Educational Codeforces Round 179 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
322898052 Spad2e F June 4, 2025, 5:58 p.m. OK C++17 (GCC 7-32) TESTS 56 77 102400
322916310 bornag F June 4, 2025, 10:37 p.m. OK C++17 (GCC 7-32) TESTS 56 93 0
322918187 LXcjh4998 F June 4, 2025, 11:42 p.m. OK C++17 (GCC 7-32) TESTS 56 93 102400
322900232 stick_cf F June 4, 2025, 6:18 p.m. OK C++17 (GCC 7-32) TESTS 56 93 102400
322898383 incster F June 4, 2025, 6:01 p.m. OK C++17 (GCC 7-32) TESTS 56 93 102400
322867726 fengqiyuka F June 4, 2025, 1:45 p.m. OK C++17 (GCC 7-32) TESTS 56 93 102400
322839761 vidux F June 4, 2025, 10:16 a.m. OK C++17 (GCC 7-32) TESTS 55 93 102400
322823286 sunchaoyi F June 4, 2025, 8:22 a.m. OK C++17 (GCC 7-32) TESTS 55 93 102400
322819463 bary F June 4, 2025, 7:55 a.m. OK C++17 (GCC 7-32) TESTS 55 93 102400
322840581 getawronganswer F June 4, 2025, 10:22 a.m. OK C++17 (GCC 7-32) TESTS 55 93 2048000
322863877 TahsinArafat F June 4, 2025, 1:17 p.m. OK C++20 (GCC 13-64) TESTS 56 62 102400
322822342 karan_garg_12 F June 4, 2025, 8:15 a.m. OK C++20 (GCC 13-64) TESTS 55 62 102400
322789979 wxgmjfhy F June 4, 2025, 2:04 a.m. OK C++20 (GCC 13-64) TESTS 55 77 0
322789765 maven07 F June 4, 2025, 2 a.m. OK C++20 (GCC 13-64) TESTS 55 77 0
322936250 Ryazimn F June 5, 2025, 5:12 a.m. OK C++20 (GCC 13-64) TESTS 56 77 102400
322935758 aisocpioneer424 F June 5, 2025, 5:07 a.m. OK C++20 (GCC 13-64) TESTS 56 77 102400
322877207 Tenjin F June 4, 2025, 2:58 p.m. OK C++20 (GCC 13-64) TESTS 56 77 102400
322870506 Winndy F June 4, 2025, 2:06 p.m. OK C++20 (GCC 13-64) TESTS 56 77 102400
322868507 flying_saucer F June 4, 2025, 1:51 p.m. OK C++20 (GCC 13-64) TESTS 56 77 102400
322859560 zyc_ovo F June 4, 2025, 12:44 p.m. OK C++20 (GCC 13-64) TESTS 56 77 102400
322790683 igoroogle F June 4, 2025, 2:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 55 61 614400
322849718 BrokenSwordWasReforged F June 4, 2025, 11:31 a.m. OK C++23 (GCC 14-64, msys2) TESTS 56 62 102400
322839001 Cai_Guang F June 4, 2025, 10:10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 55 62 102400
322798994 Teddydudu F June 4, 2025, 4:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 55 62 102400
322787705 A_G F June 4, 2025, 1:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 55 77 0
322940063 jiangly F June 5, 2025, 5:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 56 77 102400
322939805 GlobalExpress F June 5, 2025, 5:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 56 77 102400
322931732 ApolloMonasa F June 5, 2025, 4:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 56 77 102400
322928572 redzxx F June 5, 2025, 3:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 56 77 102400
322926021 Baburaoo_ganpatraoo_apte F June 5, 2025, 3:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 56 77 102400
322884102 kasiru_69 F June 4, 2025, 3:56 p.m. OK Java 8 TESTS 56 1171 0
322890796 hundunlilun1 F June 4, 2025, 4:54 p.m. OK PyPy 3-64 TESTS 56 156 10956800
322845878 jackylova_fan_fan_fan F June 4, 2025, 11:03 a.m. OK PyPy 3-64 TESTS 56 202 32768000
322831763 smilences F June 4, 2025, 9:18 a.m. OK PyPy 3-64 TESTS 55 218 10444800
322899609 smz.26 F June 4, 2025, 6:12 p.m. OK PyPy 3-64 TESTS 56 265 9318400
322782750 Jeresalen F June 3, 2025, 10:20 p.m. OK PyPy 3-64 TESTS 55 390 18022400
322775534 Meitnera1n F June 3, 2025, 8:17 p.m. OK PyPy 3-64 TESTS 55 483 22630400
322775419 Meitnera1n F June 3, 2025, 8:15 p.m. OK PyPy 3-64 TESTS 55 515 22732800
322890627 hundunlilun1 F June 4, 2025, 4:53 p.m. OK PyPy 3-64 TESTS 56 718 11776000
322832416 nik1009 F June 4, 2025, 9:23 a.m. OK PyPy 3-64 TESTS 55 1046 63692800
322832595 nikunj1009 F June 4, 2025, 9:24 a.m. OK PyPy 3-64 TESTS 55 1155 63385600
322925877 date727 F June 5, 2025, 3:04 a.m. OK Python 3 TESTS 56 984 614400
322906869 DanielAnker F June 4, 2025, 7:33 p.m. OK Rust 2021 TESTS 56 702 102400

remove filters

Back to search problems