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
( 11701 ) C Symmetrical Polygons PROGRAMMING geometry greedy sortings

You are given (n) sticks, where the (i)-th stick has a length of (a_i). You want to choose a non-empty subset of these sticks and use them as the sides of a polygon. Each selected stick must be used entirely as a single side of the polygon. It is not allowed for two or more sticks to be joined end-to-end in parallel to form a longer side. Your goal is to form a polygon that is symmetrical, strictly convex, and non-degenerate: Symmetrical : there exists a line of symmetry such that when the polygon is folded along this line, the two halves coincide exactly. Strictly convex : all its internal angles are strictly less than (180^\circ). Non-degenerate : no two consecutive sides coincide at least partially, no side has zero length, and no angle equals (180^\circ). Among all such polygons that you can form with the sticks, find the maximum possible perimeter(^{\text{∗}}). If no valid polygon exists, output (0). (^{\text{∗}})The perimeter of a polygon is equal to the sum of the lengths of its sides. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((3\le n\le 2\cdot 10^5)) — the number of sticks. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1\le a_i\le 10^9)) — the lengths of the sticks. It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot 10^5). For each test case, output a single integer representing the maximum possible perimeter of a non-degenerate, symmetrical and strictly convex polygon that you can form from a non-empty subset of the sticks. If it is not possible, output (0). In the first test case, you can form an isosceles triangle using all three sticks. It is symmetrical along the vertical dotted line (see left diagram). The perimeter is equal to th

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
343049655 ksandr1v C Oct. 10, 2025, 11:20 p.m. OK C# 13 TESTS 23 265 21196800
343050541 ArturoR2D2 C Oct. 10, 2025, 11:49 p.m. OK C++17 (GCC 7-32) TESTS 23 93 0
343048627 LomanTrue C Oct. 10, 2025, 10:52 p.m. OK C++17 (GCC 7-32) TESTS 23 108 0
343063327 threebear C Oct. 11, 2025, 4:08 a.m. OK C++17 (GCC 7-32) TESTS 23 108 921600
343065495 mikhail_10101 C Oct. 11, 2025, 4:37 a.m. OK C++17 (GCC 7-32) TESTS 23 109 0
343063764 ThisIsAmit C Oct. 11, 2025, 4:14 a.m. OK C++17 (GCC 7-32) TESTS 23 109 0
343046946 Heman10x C Oct. 10, 2025, 10:12 p.m. OK C++17 (GCC 7-32) TESTS 23 109 102400
343035915 rohan2210 C Oct. 10, 2025, 7:42 p.m. OK C++17 (GCC 7-32) TESTS 23 109 102400
343073266 jeelsavsani20002155 C Oct. 11, 2025, 5:53 a.m. OK C++17 (GCC 7-32) TESTS 23 109 921600
343069891 aryan23147 C Oct. 11, 2025, 5:22 a.m. OK C++17 (GCC 7-32) TESTS 23 109 921600
343063272 threebear C Oct. 11, 2025, 4:08 a.m. OK C++17 (GCC 7-32) TESTS 23 109 921600
343053223 dustdream C Oct. 11, 2025, 1:10 a.m. OK C++20 (GCC 13-64) TESTS 23 78 0
343062815 zhan8 C Oct. 11, 2025, 4:01 a.m. OK C++20 (GCC 13-64) TESTS 23 92 1945600
343067214 Dialysis C Oct. 11, 2025, 4:55 a.m. OK C++20 (GCC 13-64) TESTS 23 93 0
343060713 Mradul2004 C Oct. 11, 2025, 3:30 a.m. OK C++20 (GCC 13-64) TESTS 23 93 0
343055724 _C_B_ C Oct. 11, 2025, 2:07 a.m. OK C++20 (GCC 13-64) TESTS 23 93 102400
343054764 __C_B__ C Oct. 11, 2025, 1:47 a.m. OK C++20 (GCC 13-64) TESTS 23 93 102400
343053239 Mabingnan__V C Oct. 11, 2025, 1:10 a.m. OK C++20 (GCC 13-64) TESTS 23 93 102400
343034449 anjay1011 C Oct. 10, 2025, 7:28 p.m. OK C++20 (GCC 13-64) TESTS 23 93 102400
343056344 zzhtlx C Oct. 11, 2025, 2:19 a.m. OK C++20 (GCC 13-64) TESTS 23 93 1945600
343055634 bulupan C Oct. 11, 2025, 2:06 a.m. OK C++20 (GCC 13-64) TESTS 23 93 1945600
343053021 tanemuzzaman0084 C Oct. 11, 2025, 1:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 78 6144000
343069058 Badbottle C Oct. 11, 2025, 5:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343068210 Xiezeju C Oct. 11, 2025, 5:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343065502 hanmx C Oct. 11, 2025, 4:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343063437 perseverance_04 C Oct. 11, 2025, 4:10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343062388 _mustafo_ C Oct. 11, 2025, 3:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343058252 Citypop C Oct. 11, 2025, 2:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343057385 123m456jx C Oct. 11, 2025, 2:38 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343056586 __ALBION__ C Oct. 11, 2025, 2:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343054349 Wangzyy C Oct. 11, 2025, 1:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 93 0
343070392 shaabby C Oct. 11, 2025, 5:28 a.m. OK GNU C11 TESTS 23 109 4915200
343065269 uchihieu2k7 C Oct. 11, 2025, 4:34 a.m. OK GNU C11 TESTS 23 124 3276800
343013397 jan1337 C Oct. 10, 2025, 4:45 p.m. OK Go TESTS 22 156 17920000
343062411 owi8270 C Oct. 11, 2025, 3:55 a.m. OK Go TESTS 23 218 20275200
343071724 NpHardcore_05 C Oct. 11, 2025, 5:40 a.m. OK Java 21 TESTS 23 327 6758400
343069798 tekka_ity C Oct. 11, 2025, 5:21 a.m. OK Java 21 TESTS 23 327 7270400
343071546 AKhacks C Oct. 11, 2025, 5:38 a.m. OK Java 21 TESTS 23 374 4198400
343049568 harryhoppel C Oct. 10, 2025, 11:17 p.m. OK Java 21 TESTS 23 374 7577600
343023990 keshav_.agg C Oct. 10, 2025, 6:15 p.m. OK Java 21 TESTS 22 436 21606400
343057866 Dilip_24 C Oct. 11, 2025, 2:46 a.m. OK Java 21 TESTS 23 468 7884800
343062918 Tarun_chaudhary C Oct. 11, 2025, 4:02 a.m. OK Java 21 TESTS 23 499 18329600
343066103 minibin C Oct. 11, 2025, 4:44 a.m. OK Java 21 TESTS 23 515 15564800
343009970 This_Is_Amazing C Oct. 10, 2025, 4:37 p.m. OK Java 21 TESTS 22 531 16384000
343012612 manmohan0singh0 C Oct. 10, 2025, 4:44 p.m. OK Java 21 TESTS 22 546 16281600
343069773 harshchhallani3 C Oct. 11, 2025, 5:21 a.m. OK Java 8 TESTS 23 452 18329600
343046293 suntansoker C Oct. 10, 2025, 9:57 p.m. OK Java 8 TESTS 23 452 28876800
343037442 ez_coder C Oct. 10, 2025, 7:57 p.m. OK Java 8 TESTS 23 686 12083200
343038255 yashbansal99 C Oct. 10, 2025, 8:06 p.m. OK Java 8 TESTS 23 921 28160000
343067269 keshavraj.iitkgp C Oct. 11, 2025, 4:56 a.m. OK Java 8 TESTS 23 999 24268800
343040635 A_23 C Oct. 10, 2025, 8:33 p.m. OK Kotlin 2.2 TESTS 23 358 20480000
343032606 dglima C Oct. 10, 2025, 7:13 p.m. OK Node.js TESTS 23 280 37888000
343056805 kaedeeeee C Oct. 11, 2025, 2:27 a.m. OK PyPy 3 TESTS 23 375 23040000
343061099 Biggaypig C Oct. 11, 2025, 3:36 a.m. OK PyPy 3 TESTS 23 593 28774400
343035614 challavishweshwar C Oct. 10, 2025, 7:39 p.m. OK PyPy 3 TESTS 23 702 29491200
343045082 gardengnome C Oct. 10, 2025, 9:34 p.m. OK PyPy 3-64 TESTS 23 187 28364800
343058791 TTO76 C Oct. 11, 2025, 3 a.m. OK PyPy 3-64 TESTS 23 187 29184000
343061899 eugalt C Oct. 11, 2025, 3:48 a.m. OK PyPy 3-64 TESTS 23 202 28876800
343057229 ericshen19555 C Oct. 11, 2025, 2:35 a.m. OK PyPy 3-64 TESTS 23 218 44339200
343026046 minuki646 C Oct. 10, 2025, 6:26 p.m. OK PyPy 3-64 TESTS 23 233 28467200
343035945 jigitmax C Oct. 10, 2025, 7:43 p.m. OK PyPy 3-64 TESTS 23 234 36352000
343061211 manoharsingh2402 C Oct. 11, 2025, 3:37 a.m. OK PyPy 3-64 TESTS 23 249 27136000
343032282 MJavad C Oct. 10, 2025, 7:10 p.m. OK PyPy 3-64 TESTS 23 249 30924800
343011721 YeasyLi C Oct. 10, 2025, 4:42 p.m. OK PyPy 3-64 TESTS 22 249 31641600
343040563 Luciefer_x C Oct. 10, 2025, 8:32 p.m. OK PyPy 3-64 TESTS 23 249 35123200
343010411 Syntaxpaglu C Oct. 10, 2025, 4:38 p.m. OK Python 2 TESTS 22 812 23244800
343045304 ShivCodez C Oct. 10, 2025, 9:38 p.m. OK Python 3 TESTS 23 265 26726400
343052002 trinem C Oct. 11, 2025, 12:37 a.m. OK Python 3 TESTS 23 296 26521600
343008047 Qwertyrustam C Oct. 10, 2025, 4:32 p.m. OK Python 3 TESTS 22 296 26726400
343008992 kodolskii C Oct. 10, 2025, 4:35 p.m. OK Python 3 TESTS 22 312 26521600
343028155 bravojay C Oct. 10, 2025, 6:39 p.m. OK Python 3 TESTS 23 342 26931200
343049989 Arivoli C Oct. 10, 2025, 11:29 p.m. OK Python 3 TESTS 23 343 26931200
343061779 eugalt C Oct. 11, 2025, 3:46 a.m. OK Python 3 TESTS 23 359 28672000
343011812 Atul23710 C Oct. 10, 2025, 4:42 p.m. OK Python 3 TESTS 22 390 27750400
343010608 dathusaibatthula C Oct. 10, 2025, 4:39 p.m. OK Python 3 TESTS 22 421 26726400
343014687 Celeb17 C Oct. 10, 2025, 4:48 p.m. OK Python 3 TESTS 22 436 26931200
343067583 silicalet C Oct. 11, 2025, 4:59 a.m. OK Rust 2024 TESTS 23 93 9011200

remove filters

Back to search problems