Codeforces Round 1061 (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
2156 Codeforces Round 1061 (Div. 2) FINISHED False 7200 15089123 Oct. 24, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 26706 ) A Pizza Time PROGRAMMING brute force constructive algorithms greedy

Hao and Alex are good friends. After winning a coding competition together, they received a huge pizza as their prize. Initially, they are given (n) slices of pizza. Each day, the following process takes place: If there are at most (2) slices remaining, Alex eats all of them. Otherwise, let (m) be the current number of slices ((m\ge 3)). Hao splits them into three groups of sizes (m_1), (m_2), and (m_3) such that: ()m_1 + m_2 + m_3 = m\text{ and } 1 \le m_1\le m_2\le m_3.() Then: Hao eats (m_1) slices (the smallest group). Alex eats (m_2) slices (the middle group). The remaining (m_3) slices (the largest group) are carried over to the next day. ()m_1 + m_2 + m_3 = m\text{ and } 1 \le m_1\le m_2\le m_3.() Then: Hao eats (m_1) slices (the smallest group). Alex eats (m_2) slices (the middle group). The remaining (m_3) slices (the largest group) are carried over to the next day. Your task is to determine the maximum total number of slices Hao can eat if he always chooses the partition optimally. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first and only line of each test case contains a single integer (n) ((3 \le n \le 10^9)) — the initial number of pizza slices. Note that there are no constraints on the sum of (n) over all test cases. For each test case, output a single integer representing the maximum total number of slices Hao can eat. In the first test case, Hao can eat (3) slices as follows: Split into (m_1 = 2), (m_2 = 3), and (m_3 = 3). Hao eats (2) slices, Alex eats (3) slices, and the remaining (3) slices are carried over to the next day. Split into (m_1 = 1), (m_2 = 1), and (m_3 = 1). Hao eats (1) slice, Alex eats (1) slice, and the remaining (1) slice is carried over to the next day. Only (1)

Tutorials

Codeforces Round 1061 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
345670204 A.Rhman.Yahya A Oct. 25, 2025, 1:14 a.m. OK C# 13 TESTS 4 77 0
345640625 ksandr1v A Oct. 24, 2025, 6:28 p.m. OK C# 13 TESTS 4 93 0
345686727 arham005 A Oct. 25, 2025, 5:28 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
345683169 Marsian_25 A Oct. 25, 2025, 4:48 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
345683027 ayush_yad A Oct. 25, 2025, 4:46 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
345682886 MidhunNair A Oct. 25, 2025, 4:45 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
345677733 sharmin_16 A Oct. 25, 2025, 3:32 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
345676110 KiNnT A Oct. 25, 2025, 3:08 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
345656472 singhaabhijit264 A Oct. 24, 2025, 8:31 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
345623933 beautifullife A Oct. 24, 2025, 5:32 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
345688398 Looplegend_7 A Oct. 25, 2025, 5:43 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
345687903 ZERO_LOGIC_0L A Oct. 25, 2025, 5:39 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
345665842 Adithya-02 A Oct. 24, 2025, 11:09 p.m. OK C++20 (GCC 13-64) TESTS 4 15 0
345640279 luis01qs A Oct. 24, 2025, 6:26 p.m. OK C++20 (GCC 13-64) TESTS 4 15 0
345685545 akil1625 A Oct. 25, 2025, 5:15 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
345684257 Ankuran_2301 A Oct. 25, 2025, 5:01 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
345679390 shariyer_sijan A Oct. 25, 2025, 3:57 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
345678317 pushpendraagarwal A Oct. 25, 2025, 3:41 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
345674822 Chen_1098 A Oct. 25, 2025, 2:48 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
345669773 ukoyotu A Oct. 25, 2025, 1:03 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
345669121 cyj888 A Oct. 25, 2025, 12:48 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
345667296 czkczk A Oct. 24, 2025, 11:54 p.m. OK C++20 (GCC 13-64) TESTS 4 30 0
345684942 PriyanshuJha24 A Oct. 25, 2025, 5:08 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 15 0
345689425 nilanshucodes A Oct. 25, 2025, 5:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345682086 chinasuhang A Oct. 25, 2025, 4:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345681516 hdt1 A Oct. 25, 2025, 4:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345678326 roni126 A Oct. 25, 2025, 3:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345672393 hierologistzoaqg A Oct. 25, 2025, 2:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345668922 SynaptiK. A Oct. 25, 2025, 12:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345645902 simarbhatti A Oct. 24, 2025, 6:59 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345643619 hmz A Oct. 24, 2025, 6:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345624262 beluga_yeet A Oct. 24, 2025, 5:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
345631283 Papiba A Oct. 24, 2025, 6:01 p.m. OK GNU C11 TESTS 4 30 102400
345672632 codedcking A Oct. 25, 2025, 2:08 a.m. OK GNU C11 TESTS 4 31 0
345690084 KL2400031478 A Oct. 25, 2025, 5:57 a.m. OK GNU C11 TESTS 4 31 102400
345668807 A.Rhman.Yahya A Oct. 25, 2025, 12:40 a.m. OK GNU C11 TESTS 4 31 102400
345653434 dumbalien A Oct. 24, 2025, 8 p.m. OK GNU C11 TESTS 4 31 102400
345648186 houoin A Oct. 24, 2025, 7:16 p.m. OK GNU C11 TESTS 4 31 102400
345641365 ViniVici19 A Oct. 24, 2025, 6:32 p.m. OK GNU C11 TESTS 4 31 102400
345613381 Buruz A Oct. 24, 2025, 4:26 p.m. OK GNU C11 TESTS 4 31 102400
345674970 deepak3007_ A Oct. 25, 2025, 2:50 a.m. OK GNU C11 TESTS 4 46 0
345671612 Jabir_35 A Oct. 25, 2025, 1:47 a.m. OK GNU C11 TESTS 4 46 0
345679864 uffhottie A Oct. 25, 2025, 4:03 a.m. OK Go TESTS 4 46 0
345643190 fishy15 A Oct. 24, 2025, 6:43 p.m. OK Haskell TESTS 4 62 0
345651409 chpkrishnamohan A Oct. 24, 2025, 7:42 p.m. OK Java 21 TESTS 4 202 307200
345654415 DharmeshBangara A Oct. 24, 2025, 8:11 p.m. OK Java 21 TESTS 4 203 102400
345670883 Bhuvi_will A Oct. 25, 2025, 1:30 a.m. OK Java 21 TESTS 4 217 716800
345678901 harshalwaghmare89 A Oct. 25, 2025, 3:50 a.m. OK Java 21 TESTS 4 218 102400
345657432 Nandini_21 A Oct. 24, 2025, 8:41 p.m. OK Java 21 TESTS 4 218 307200
345660597 sagbis A Oct. 24, 2025, 9:21 p.m. OK Java 21 TESTS 4 233 204800
345625735 WrongAnswerOnTestCase2 A Oct. 24, 2025, 5:40 p.m. OK Java 21 TESTS 4 233 307200
345614502 manmohan0singh0 A Oct. 24, 2025, 4:28 p.m. OK Java 21 TESTS 4 233 409600
345675925 mayurbhai A Oct. 25, 2025, 3:05 a.m. OK Java 21 TESTS 4 233 512000
345636980 harshwardhanraj2004 A Oct. 24, 2025, 6:10 p.m. OK Java 21 TESTS 4 233 2355200
345682046 Vishalll_ A Oct. 25, 2025, 4:34 a.m. OK Java 8 TESTS 4 124 0
345646205 mdtahsin4460 A Oct. 24, 2025, 7:01 p.m. OK Java 8 TESTS 4 155 0
345617152 PratikSahoo A Oct. 24, 2025, 4:32 p.m. OK Java 8 TESTS 4 171 0
345650988 manubhav731 A Oct. 24, 2025, 7:38 p.m. OK Java 8 TESTS 4 186 0
345639055 tabseer A Oct. 24, 2025, 6:20 p.m. OK Java 8 TESTS 4 186 0
345616036 yashu_rai A Oct. 24, 2025, 4:31 p.m. OK Java 8 TESTS 4 186 0
345638019 Any01Ket A Oct. 24, 2025, 6:15 p.m. OK Java 8 TESTS 4 187 0
345626796 nareshveerapuram07 A Oct. 24, 2025, 5:45 p.m. OK Java 8 TESTS 4 187 0
345624763 21eg105h53 A Oct. 24, 2025, 5:36 p.m. OK Java 8 TESTS 4 187 0
345615949 KLU2300033409 A Oct. 24, 2025, 4:31 p.m. OK Java 8 TESTS 4 203 0
345623645 swseverance A Oct. 24, 2025, 5:31 p.m. OK Node.js TESTS 4 109 1228800
345659995 krxshh A Oct. 24, 2025, 9:12 p.m. OK PyPy 3 TESTS 4 108 2867200
345676008 keerthivallem22 A Oct. 25, 2025, 3:07 a.m. OK PyPy 3 TESTS 4 109 3174400
345689297 BakhtiyarZBJ A Oct. 25, 2025, 5:51 a.m. OK PyPy 3-64 TESTS 4 62 0
345671272 HK-Athy A Oct. 25, 2025, 1:39 a.m. OK PyPy 3-64 TESTS 4 62 0
345689369 LMeyling A Oct. 25, 2025, 5:51 a.m. OK PyPy 3-64 TESTS 4 77 0
345688833 ami_XR A Oct. 25, 2025, 5:47 a.m. OK PyPy 3-64 TESTS 4 77 0
345687133 nandan767644 A Oct. 25, 2025, 5:32 a.m. OK PyPy 3-64 TESTS 4 77 0
345667981 AryanSeth A Oct. 25, 2025, 12:17 a.m. OK PyPy 3-64 TESTS 4 77 0
345676158 gyroooo A Oct. 25, 2025, 3:09 a.m. OK PyPy 3-64 TESTS 4 77 1228800
345673540 Shyam414 A Oct. 25, 2025, 2:26 a.m. OK PyPy 3-64 TESTS 4 77 1331200
345671560 M.AbdurRehman A Oct. 25, 2025, 1:45 a.m. OK PyPy 3-64 TESTS 4 77 1331200
345668293 A.Rhman.Yahya A Oct. 25, 2025, 12:27 a.m. OK PyPy 3-64 TESTS 4 77 1331200
345690158 SteveCoder A Oct. 25, 2025, 5:58 a.m. OK Python 3 TESTS 4 61 0
345688966 Ashin06 A Oct. 25, 2025, 5:48 a.m. OK Python 3 TESTS 4 61 0
345665188 pt50hgm A Oct. 24, 2025, 10:49 p.m. OK Python 3 TESTS 4 61 0
345653915 nikhilreddy3 A Oct. 24, 2025, 8:05 p.m. OK Python 3 TESTS 4 61 0
345644783 rkkvbksc3 A Oct. 24, 2025, 6:52 p.m. OK Python 3 TESTS 4 61 0
345625117 rohankcdeadshot A Oct. 24, 2025, 5:37 p.m. OK Python 3 TESTS 4 61 0
345688685 hobbit500 A Oct. 25, 2025, 5:46 a.m. OK Python 3 TESTS 4 62 0
345684172 shreshthhh A Oct. 25, 2025, 4:59 a.m. OK Python 3 TESTS 4 62 0
345683782 SteveCoder A Oct. 25, 2025, 4:55 a.m. OK Python 3 TESTS 4 62 0
345682934 Sourcing A Oct. 25, 2025, 4:45 a.m. OK Python 3 TESTS 4 62 0
345654215 DreadedHippy A Oct. 24, 2025, 8:08 p.m. OK Rust 2021 TESTS 4 46 0

remove filters

Back to search problems