Codeforces Round 1057 (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
2153 Codeforces Round 1057 (Div. 2) FINISHED False 8100 16298723 Oct. 10, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 26263 ) A Circle of Apple Trees PROGRAMMING greedy

There are (n) apple trees arranged in a circle. Each tree bears exactly one apple, and the beauty of the apple on the (i)-th tree is given by (b_i) for all (1\le i\le n). You start in front of tree (1). At each tree, you may choose to either eat the apple or skip it. After making your choice, you move to the next tree: from tree (i), you move to tree (i+1) for (1 \le i \le n - 1), and from tree (n), you move back to tree (1). This process continues indefinitely as you move through the trees in a cycle. However, you have a special condition: you may only eat an apple if its beauty is strictly greater than the beauty of the last apple you ate. For example, if (b = 2, 1, 2, 3) and you eat the apple on tree (1) (beauty (2)), you cannot eat the apples on trees (2) and (3) because their beauties are not greater than (2). However, you may eat the apple on tree (4) since (b_4 = 3 > 2). Note that you are allowed to skip an apple when you first encounter it, and you can choose to eat it later on a subsequent cycle. Your task is to determine the maximum number of apples you can eat if you make optimal decisions on when to eat or skip each apple. 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 line of each test case contains a single integer (n) ((1 \le n\le 100)) — the number of apple trees. The second line of each test case contains (n) integers (b_1, b_2, \ldots, b_n) ((1\le b_i\le n)) — the beauty of the apples on the trees. 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 number of apples you can eat. In the first test case, since all apples have the same beauty, no matter which apple you eat first, you cannot eat any others afterward. Hence, the max

Tutorials

Codeforces Round 1057 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
343046326 ksandr1v A Oct. 10, 2025, 9:58 p.m. OK C# 13 TESTS 4 77 716800
343011118 Bhagyasree40 A Oct. 10, 2025, 4:40 p.m. OK C# 13 TESTS 4 78 2969600
343070025 linlic A Oct. 11, 2025, 5:24 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343067584 DoomDust7 A Oct. 11, 2025, 4:59 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343071852 Zorenth A Oct. 11, 2025, 5:41 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
343051903 Satyanshu111 A Oct. 11, 2025, 12:35 a.m. OK C++17 (GCC 7-32) TESTS 4 31 0
343073119 YashAdityaPaul A Oct. 11, 2025, 5:52 a.m. OK C++17 (GCC 7-32) TESTS 4 46 0
343073009 BaCl2_ A Oct. 11, 2025, 5:51 a.m. OK C++17 (GCC 7-32) TESTS 4 46 0
343072733 franky_314 A Oct. 11, 2025, 5:49 a.m. OK C++17 (GCC 7-32) TESTS 4 46 0
343072134 Markjk A Oct. 11, 2025, 5:44 a.m. OK C++17 (GCC 7-32) TESTS 4 46 0
343072089 yuvraj133 A Oct. 11, 2025, 5:43 a.m. OK C++17 (GCC 7-32) TESTS 4 46 0
343071843 hermitology A Oct. 11, 2025, 5:41 a.m. OK C++17 (GCC 7-32) TESTS 4 46 0
343054649 Saif_Bhuiyan A Oct. 11, 2025, 1:45 a.m. OK C++20 (GCC 13-64) TESTS 4 31 0
343074259 mani_tyuG A Oct. 11, 2025, 6:02 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343073990 Shashass A Oct. 11, 2025, 5:59 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343072689 snowknight A Oct. 11, 2025, 5:48 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343071747 Pradeep95 A Oct. 11, 2025, 5:40 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343068760 5am__Arpit A Oct. 11, 2025, 5:10 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343068471 goyal_pranav A Oct. 11, 2025, 5:08 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343067526 therks A Oct. 11, 2025, 4:58 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343067335 nnapalm A Oct. 11, 2025, 4:57 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343066531 Siyam_Talukder A Oct. 11, 2025, 4:49 a.m. OK C++20 (GCC 13-64) TESTS 4 46 0
343060254 vikash.vaibhaw A Oct. 11, 2025, 3:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343070331 dhir6927 A Oct. 11, 2025, 5:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
343067327 adipun A Oct. 11, 2025, 4:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
343063321 SDY_25 A Oct. 11, 2025, 4:08 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
343058889 _Dusker A Oct. 11, 2025, 3:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
343052140 mpboss A Oct. 11, 2025, 12:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 31 0
343074786 HarsH_5213 A Oct. 11, 2025, 6:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
343074483 pinkeshv2004 A Oct. 11, 2025, 6:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
343074475 vaibhavdeeptmurty A Oct. 11, 2025, 6:03 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
343074128 chhhcooh A Oct. 11, 2025, 6:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 0
343024663 ddminh2607 A Oct. 10, 2025, 6:18 p.m. OK GNU C11 TESTS 4 31 0
343010665 MahamudulFerdous A Oct. 10, 2025, 4:39 p.m. OK GNU C11 TESTS 4 31 0
343028311 FJA A Oct. 10, 2025, 6:40 p.m. OK GNU C11 TESTS 4 46 0
343015350 anujjnv45 A Oct. 10, 2025, 4:49 p.m. OK GNU C11 TESTS 4 46 0
343037101 Alpha_Zeros A Oct. 10, 2025, 7:54 p.m. OK GNU C11 TESTS 4 46 102400
343026729 TOWFIQCHOWDHURY321 A Oct. 10, 2025, 6:30 p.m. OK GNU C11 TESTS 4 46 102400
343009127 wreckThorium A Oct. 10, 2025, 4:35 p.m. OK GNU C11 TESTS 4 46 102400
343025964 sans1441 A Oct. 10, 2025, 6:25 p.m. OK GNU C11 TESTS 4 62 102400
343072850 amayank18 A Oct. 11, 2025, 5:50 a.m. OK Java 21 TESTS 4 202 409600
343037971 dharahas A Oct. 10, 2025, 8:03 p.m. OK Java 21 TESTS 4 217 102400
343072010 kartik__sethi A Oct. 11, 2025, 5:43 a.m. OK Java 21 TESTS 4 218 307200
343067924 AKhacks A Oct. 11, 2025, 5:02 a.m. OK Java 21 TESTS 4 218 1433600
343031341 tekka_ity A Oct. 10, 2025, 7:02 p.m. OK Java 21 TESTS 4 233 102400
343033262 priyank_4_sure A Oct. 10, 2025, 7:19 p.m. OK Java 21 TESTS 4 233 1945600
343046685 shihmaz A Oct. 10, 2025, 10:06 p.m. OK Java 21 TESTS 4 249 0
343065023 CoHHa9_MyXa A Oct. 11, 2025, 4:31 a.m. OK Java 21 TESTS 4 249 204800
343064612 mani9866 A Oct. 11, 2025, 4:26 a.m. OK Java 21 TESTS 4 249 921600
343061596 minibin A Oct. 11, 2025, 3:43 a.m. OK Java 21 TESTS 4 249 1740800
343070337 adibhai0845R A Oct. 11, 2025, 5:27 a.m. OK Java 8 TESTS 4 124 0
343034925 suntansoker A Oct. 10, 2025, 7:33 p.m. OK Java 8 TESTS 4 139 0
343037489 hiddenhopes A Oct. 10, 2025, 7:58 p.m. OK Java 8 TESTS 4 140 0
343012019 Khushi_rai04 A Oct. 10, 2025, 4:42 p.m. OK Java 8 TESTS 4 140 0
343070811 lupunish A Oct. 11, 2025, 5:31 a.m. OK Java 8 TESTS 4 156 0
343063884 NithishReddyK A Oct. 11, 2025, 4:16 a.m. OK Java 8 TESTS 4 171 0
343071588 devchan-r3f A Oct. 11, 2025, 5:39 a.m. OK Java 8 TESTS 4 202 0
343032254 klu_2100030001 A Oct. 10, 2025, 7:10 p.m. OK Java 8 TESTS 4 202 0
343010692 Amrutha_Korumilli A Oct. 10, 2025, 4:39 p.m. OK Java 8 TESTS 4 202 0
343011636 nkeerthika A Oct. 10, 2025, 4:41 p.m. OK Java 8 TESTS 4 217 0
343050961 hg232103 A Oct. 11, 2025, 12:04 a.m. OK JavaScript TESTS 4 77 2355200
343028812 TeatBoom A Oct. 10, 2025, 6:44 p.m. OK PyPy 3 TESTS 4 155 4710400
343069472 Vedant_Vispute A Oct. 11, 2025, 5:17 a.m. OK PyPy 3 TESTS 4 156 2662400
343068733 mengesama A Oct. 11, 2025, 5:10 a.m. OK PyPy 3-64 TESTS 4 77 1638400
343069779 brahmasees A Oct. 11, 2025, 5:21 a.m. OK PyPy 3-64 TESTS 4 77 1740800
343061436 bhavsar_dhruvn A Oct. 11, 2025, 3:40 a.m. OK PyPy 3-64 TESTS 4 77 1740800
343060965 dhrxv._ A Oct. 11, 2025, 3:34 a.m. OK PyPy 3-64 TESTS 4 77 1740800
343056182 aviral311 A Oct. 11, 2025, 2:16 a.m. OK PyPy 3-64 TESTS 4 77 1740800
343052920 ehdnjs14 A Oct. 11, 2025, 1:01 a.m. OK PyPy 3-64 TESTS 4 77 1740800
343048510 dokidoki_bro A Oct. 10, 2025, 10:49 p.m. OK PyPy 3-64 TESTS 4 77 1740800
343044157 gardengnome A Oct. 10, 2025, 9:19 p.m. OK PyPy 3-64 TESTS 4 78 1740800
343008859 who000 A Oct. 10, 2025, 4:35 p.m. OK PyPy 3-64 TESTS 4 78 6963200
343041560 romerproblem A Oct. 10, 2025, 8:44 p.m. OK PyPy 3-64 TESTS 4 92 1740800
343010217 mukundtg81 A Oct. 10, 2025, 4:38 p.m. OK Python 2 TESTS 4 93 0
343061566 keshu_bara A Oct. 11, 2025, 3:42 a.m. OK Python 3 TESTS 4 61 0
343069602 iason_2704 A Oct. 11, 2025, 5:19 a.m. OK Python 3 TESTS 4 62 0
343061450 sravanKumar3 A Oct. 11, 2025, 3:41 a.m. OK Python 3 TESTS 4 62 0
343059645 andiamironmanu A Oct. 11, 2025, 3:13 a.m. OK Python 3 TESTS 4 62 0
343051361 jkey725 A Oct. 11, 2025, 12:18 a.m. OK Python 3 TESTS 4 62 0
343048391 dokidoki_bro A Oct. 10, 2025, 10:46 p.m. OK Python 3 TESTS 4 62 0
343039620 RisingStar_01 A Oct. 10, 2025, 8:21 p.m. OK Python 3 TESTS 4 62 0
343026708 syedsabbirahmed A Oct. 10, 2025, 6:30 p.m. OK Python 3 TESTS 4 62 0
343023965 bravojay A Oct. 10, 2025, 6:15 p.m. OK Python 3 TESTS 4 62 0
343062313 aviiiii2130 A Oct. 11, 2025, 3:53 a.m. OK Python 3 TESTS 4 62 614400
343067487 silicalet A Oct. 11, 2025, 4:58 a.m. OK Rust 2024 TESTS 4 46 0
343057829 _usan A Oct. 11, 2025, 2:45 a.m. OK Rust 2024 TESTS 4 61 0

remove filters

Back to search problems