Codeforces Round 1033 (Div. 2) and CodeNite 2025

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
2120 Codeforces Round 1033 (Div. 2) and CodeNite 2025 FINISHED False 7200 25889123 June 21, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 12482 ) C Divine Tree PROGRAMMING constructive algorithms greedy math sortings trees

Harshith attained enlightenment in Competitive Programming by training under a Divine Tree. A divine tree is a rooted tree(^{\text{∗}}) with (n) nodes, labelled from (1) to (n). The divineness of a node (v), denoted (d(v)), is defined as the smallest node label on the unique simple path from the root to node (v). Aryan, being a hungry Competitive Programmer, asked Harshith to pass on the knowledge. Harshith agreed on the condition that Aryan would be given two positive integers (n) and (m), and he had to construct a divine tree with (n) nodes such that the total divineness of the tree is (m), i.e., (\displaystyle\sum\limits_{i=1}^n d(i)=m). If no such tree exists, Aryan must report that it is impossible. Desperate for knowledge, Aryan turned to you for help in completing this task. As a good friend of his, help him solve the task. (^{\text{∗}})A tree is a connected graph without cycles. A rooted tree is a tree where one vertex is special and called the root. 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 two integers (n) and (m) ((1 \le n \le 10^6), (1 \le m \le 10^{12})). It is guaranteed that the sum of (n) over all test cases does not exceed (10^6). For each test case, output a single integer (k) in one line — the root of the tree. Then (n-1) lines follow, each containing a description of an edge of the tree — a pair of positive integers (u_i,v_i) ((1\le u_i,v_i\le n), (u_i\ne v_i)), denoting the (i)-th edge connects vertices (u_i) and (v_i). The edges and vertices of the edges can be printed in any order. If there are multiple solutions, print any of them. If there is no solution, print "-1" instead. In the first test case, there is a single node with a value of (1), so getting a sum

Tutorials

Codeforces Round 1033 (Div. 2) and CodeNite 2025 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
325484834 og.kostya C June 21, 2025, 5:14 p.m. OK C# 10 TESTS 20 124 3891200
325501609 rahulkrt C June 22, 2025, 3:07 a.m. OK C++17 (GCC 7-32) TESTS 20 93 0
325487168 BreakingGood C June 21, 2025, 5:28 p.m. OK C++17 (GCC 7-32) TESTS 20 93 102400
325479667 pro_geek C June 21, 2025, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
325477091 blank_0.1 C June 21, 2025, 4:24 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
325474768 Echo6214 C June 21, 2025, 4:18 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
325471907 ashrafulalamasad C June 21, 2025, 4:11 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
325468141 shaikjameelurrahaman C June 21, 2025, 4:02 p.m. OK C++17 (GCC 7-32) TESTS 20 108 0
325504553 dark_ethics C June 22, 2025, 3:59 a.m. OK C++17 (GCC 7-32) TESTS 20 108 102400
325497863 issacnitin123 C June 22, 2025, 2:04 a.m. OK C++17 (GCC 7-32) TESTS 20 108 102400
325481451 Ansh29 C June 21, 2025, 4:34 p.m. OK C++17 (GCC 7-32) TESTS 20 108 102400
325485406 Hancles_Lahza C June 21, 2025, 5:17 p.m. OK C++20 (GCC 13-64) TESTS 20 77 0
325470280 devansh2624 C June 21, 2025, 4:07 p.m. OK C++20 (GCC 13-64) TESTS 20 77 0
325507814 Yu1211 C June 22, 2025, 4:54 a.m. OK C++20 (GCC 13-64) TESTS 20 77 102400
325504233 dilanjuan039 C June 22, 2025, 3:54 a.m. OK C++20 (GCC 13-64) TESTS 20 77 102400
325501045 abncdf C June 22, 2025, 2:56 a.m. OK C++20 (GCC 13-64) TESTS 20 77 102400
325495357 Rahadvai C June 21, 2025, 6:38 p.m. OK C++20 (GCC 13-64) TESTS 20 77 102400
325494327 GalacticDragon C June 21, 2025, 6:26 p.m. OK C++20 (GCC 13-64) TESTS 20 77 102400
325493898 snowflame69 C June 21, 2025, 6:22 p.m. OK C++20 (GCC 13-64) TESTS 20 77 102400
325493837 Blazkowicz C June 21, 2025, 6:22 p.m. OK C++20 (GCC 13-64) TESTS 20 77 102400
325485183 zsh66 C June 21, 2025, 5:16 p.m. OK C++20 (GCC 13-64) TESTS 20 77 102400
325475209 chaitanyav23 C June 21, 2025, 4:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 62 0
325487666 igoroogle C June 21, 2025, 5:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 0
325484742 Singh_Ram C June 21, 2025, 5:14 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 0
325480692 Adam_GS C June 21, 2025, 4:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 0
325479912 aditdx C June 21, 2025, 4:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 0
325477936 Manideep1 C June 21, 2025, 4:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 0
325470724 M-Sa3dy C June 21, 2025, 4:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 0
325467765 _Dr_Baraa C June 21, 2025, 4:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 0
325467743 gravopt25 C June 21, 2025, 4:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 0
325505702 shuanglin C June 22, 2025, 4:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 77 102400
325488281 ruban C June 21, 2025, 5:35 p.m. OK FPC TESTS 20 702 167526400
325479492 Andrew_is_alive C June 21, 2025, 4:30 p.m. OK GNU C11 TESTS 20 1906 409600
325474654 Raghav_Bhatia04 C June 21, 2025, 4:18 p.m. OK GNU C11 TESTS 20 1952 3276800
325484895 kathanshah743 C June 21, 2025, 5:14 p.m. OK GNU C11 TESTS 20 1983 716800
325487974 daidao C June 21, 2025, 5:33 p.m. OK Go TESTS 20 93 3481600
325468452 triperci C June 21, 2025, 4:03 p.m. OK Go TESTS 20 109 4812800
325472070 d.o. C June 21, 2025, 4:11 p.m. OK Go TESTS 20 124 4608000
325468808 shivansh_123 C June 21, 2025, 4:04 p.m. OK Java 21 TESTS 20 280 5017600
325489290 Abhinav_Mani C June 21, 2025, 5:43 p.m. OK Java 21 TESTS 20 327 1331200
325476095 sajjan28yadav C June 21, 2025, 4:22 p.m. OK Java 21 TESTS 20 327 4812800
325467731 Bidoof C June 21, 2025, 4:02 p.m. OK Java 21 TESTS 20 358 1024000
325478742 tomcat11 C June 21, 2025, 4:29 p.m. OK Java 21 TESTS 20 358 1638400
325479562 vc81 C June 21, 2025, 4:30 p.m. OK Java 21 TESTS 20 374 716800
325473128 shadowBlaze29 C June 21, 2025, 4:14 p.m. OK Java 21 TESTS 20 390 614400
325485612 _CHEEMS_ C June 21, 2025, 5:18 p.m. OK Java 21 TESTS 20 421 7577600
325495288 vinay_panwar C June 21, 2025, 6:37 p.m. OK Java 21 TESTS 20 421 24371200
325473702 SathvikGoud C June 21, 2025, 4:16 p.m. OK Java 21 TESTS 20 452 2048000
325485009 LowRated1029 C June 21, 2025, 5:15 p.m. OK Java 8 TESTS 20 218 0
325476024 dhruvil_8803 C June 21, 2025, 4:22 p.m. OK Java 8 TESTS 20 234 0
325473497 codesuv C June 21, 2025, 4:15 p.m. OK Java 8 TESTS 20 249 0
325469437 abhayrajnegi0416 C June 21, 2025, 4:05 p.m. OK Java 8 TESTS 20 249 0
325493170 xmjlove C June 21, 2025, 6:15 p.m. OK Java 8 TESTS 20 249 8396800
325473238 ayush_chaudhary23 C June 21, 2025, 4:14 p.m. OK Java 8 TESTS 20 250 0
325474531 SamyajitDas C June 21, 2025, 4:18 p.m. OK Java 8 TESTS 20 265 0
325470090 Demonslayer_k114 C June 21, 2025, 4:07 p.m. OK Java 8 TESTS 20 281 0
325476585 Ashishchahar C June 21, 2025, 4:23 p.m. OK Java 8 TESTS 20 311 0
325485048 tirthgohil1410 C June 21, 2025, 5:15 p.m. OK Java 8 TESTS 20 358 0
325479768 jagbarrameda C June 21, 2025, 4:31 p.m. OK Kotlin 1.9 TESTS 20 249 409600
325479787 Tharun_P.T.S C June 21, 2025, 4:31 p.m. OK PyPy 3 TESTS 20 671 10649600
325468091 Professor____ C June 21, 2025, 4:02 p.m. OK PyPy 3 TESTS 20 718 11059200
325468801 SamuelMaltais C June 21, 2025, 4:04 p.m. OK PyPy 3 TESTS 20 749 10854400
325481471 Istiyak_Raz C June 21, 2025, 4:34 p.m. OK PyPy 3 TESTS 20 843 13312000
325475097 aayushprasad00691 C June 21, 2025, 4:19 p.m. OK PyPy 3 TESTS 20 921 21196800
325474924 dm1triysergeev C June 21, 2025, 4:19 p.m. OK PyPy 3 TESTS 20 937 11264000
325481216 Adarsh55 C June 21, 2025, 4:34 p.m. OK PyPy 3 TESTS 20 1390 11980800
325494615 gardengnome C June 21, 2025, 6:29 p.m. OK PyPy 3-64 TESTS 20 171 16179200
325466724 Mukundan314 C June 21, 2025, 3:59 p.m. OK PyPy 3-64 TESTS 20 233 11571200
325469828 akshatgupta__ C June 21, 2025, 4:06 p.m. OK PyPy 3-64 TESTS 20 233 44134400
325477016 maharaja C June 21, 2025, 4:24 p.m. OK PyPy 3-64 TESTS 20 249 12390400
325480743 thanhtrnnn C June 21, 2025, 4:33 p.m. OK PyPy 3-64 TESTS 20 249 14028800
325469740 PaRsHvMeShIyA C June 21, 2025, 4:06 p.m. OK PyPy 3-64 TESTS 20 249 44236800
325472651 nilan425 C June 21, 2025, 4:13 p.m. OK PyPy 3-64 TESTS 20 265 12902400
325472576 Euler06 C June 21, 2025, 4:13 p.m. OK PyPy 3-64 TESTS 20 280 19865600
325476166 Lordtop4ik C June 21, 2025, 4:22 p.m. OK PyPy 3-64 TESTS 20 296 10035200
325466195 Saurabh124 C June 21, 2025, 3:57 p.m. OK PyPy 3-64 TESTS 20 296 10137600
325474795 Arpitkush087 C June 21, 2025, 4:18 p.m. OK Python 2 TESTS 20 750 14233600
325474692 aleef C June 21, 2025, 4:18 p.m. OK Python 3 TESTS 20 234 42188800
325480387 Arora962 C June 21, 2025, 4:32 p.m. OK Python 3 TESTS 20 249 30924800
325475754 sactemp3 C June 21, 2025, 4:21 p.m. OK Python 3 TESTS 20 296 42393600
325489076 AgiKAdevta C June 21, 2025, 5:42 p.m. OK Python 3 TESTS 20 343 38502400
325475914 devilalchoudhary67 C June 21, 2025, 4:21 p.m. OK Python 3 TESTS 20 390 23040000
325467645 Saurabh_Bhaskar_5 C June 21, 2025, 4:01 p.m. OK Python 3 TESTS 20 390 39731200
325471522 SrijonKumarShill C June 21, 2025, 4:10 p.m. OK Python 3 TESTS 20 390 41779200
325468769 meshs20 C June 21, 2025, 4:03 p.m. OK Python 3 TESTS 20 468 3072000
325473528 TheSunnyBoy C June 21, 2025, 4:15 p.m. OK Python 3 TESTS 20 718 11878400
325477789 tsruu C June 21, 2025, 4:26 p.m. OK Python 3 TESTS 20 906 1331200
325503492 enpotid C June 22, 2025, 3:42 a.m. OK Rust 2021 TESTS 20 77 102400
325479837 blackpanther_7 C June 21, 2025, 4:31 p.m. OK Rust 2021 TESTS 20 77 102400
325472329 sankxt143 C June 21, 2025, 4:12 p.m. OK Rust 2021 TESTS 20 93 5222400
325480494 XORcist010 C June 21, 2025, 4:32 p.m. OK Rust 2021 TESTS 20 749 102400
325481438 DreadedHippy C June 21, 2025, 4:34 p.m. OK Rust 2021 TESTS 20 812 0
325468475 NagisaF C June 21, 2025, 4:03 p.m. OK Rust 2021 TESTS 20 968 0

remove filters

Back to search problems