Codeforces Global Round 19

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
1637 Codeforces Global Round 19 FINISHED False 9000 92589863 Feb. 12, 2022, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 541 ) G Birthday PROGRAMMING constructive algorithms math

B"Vitaly gave Maxim n numbers 1, 2, ldots, n for his 16 -th birthday. Maxim was tired of playing board games during the celebration, so he decided to play with these numbers. In one step Maxim can choose two numbers x and y from the numbers he has, throw them away, and add two numbers x + y and |x - y| instead. He wants all his numbers to be equal after several steps and the sum of the numbers to be minimal. Help Maxim to find a solution. Maxim's friends don't want to wait long, so the number of steps in the solution should not exceed 20n . It is guaranteed that under the given constraints, if a solution exists, then there exists a solution that makes all numbers equal, minimizes their sum, and spends no more than 20n moves. The first line contains a single integer t ( 1 <= t <= 25 ,000 ) -- the number of test cases. Each test case contains a single integer n ( 2 <= n <= 5 cdot 10^4 ) -- the number of integers given to Maxim. It is guaranteed that the total sum of n doesn't exceed 5 cdot 10^4 . For each test case print -1 if it's impossible to make all numbers equal. Otherwise print a single integer s ( 0 <= s <= 20n ) -- the number of steps. Then print s lines. The i -th line must contain two integers x_i and y_i -- numbers that Maxim chooses on the i -th step. The numbers must become equal after all operations. Don't forget that you not only need to make all numbers equal, but also minimize their sum. It is guaranteed that under the given constraints, if a solution exists, then there exists a solution that makes all numbers equal, minimizes their sum, and spends no more than 20n moves. "...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
146148190 hos.lyric G Feb. 12, 2022, 4:51 p.m. OK D TESTS 63 156 6144000
146179654 rainboy G Feb. 12, 2022, 11:24 p.m. OK GNU C11 TESTS 64 436 8192000
146187123 happyguy656 G Feb. 13, 2022, 2:49 a.m. OK GNU C++14 TESTS 64 62 8499200
146152073 Eric_hooo G Feb. 12, 2022, 5:01 p.m. OK GNU C++14 TESTS 63 77 6963200
146149507 ugly2333 G Feb. 12, 2022, 4:55 p.m. OK GNU C++14 TESTS 63 77 9830400
146187643 SoiMae G Feb. 13, 2022, 3:01 a.m. OK GNU C++14 TESTS 64 77 15257600
146172451 Potassium G Feb. 12, 2022, 8:44 p.m. OK GNU C++14 TESTS 63 78 7168000
146147300 KrK G Feb. 12, 2022, 4:49 p.m. OK GNU C++14 TESTS 63 78 8499200
146184759 ccf_n0i G Feb. 13, 2022, 1:52 a.m. OK GNU C++14 TESTS 64 93 2150400
146165376 eecs G Feb. 12, 2022, 7:08 p.m. OK GNU C++14 TESTS 63 93 7475200
146165366 eecs G Feb. 12, 2022, 7:08 p.m. OK GNU C++14 TESTS 63 108 7475200
146166350 eecs G Feb. 12, 2022, 7:20 p.m. OK GNU C++14 TESTS 63 108 7475200
146156971 Pyqe G Feb. 12, 2022, 6 p.m. OK GNU C++17 TESTS 63 61 16793600
146184371 ympc2005 G Feb. 13, 2022, 1:41 a.m. OK GNU C++17 TESTS 64 62 26112000
146178234 patou G Feb. 12, 2022, 10:43 p.m. OK GNU C++17 TESTS 64 77 5939200
146163556 BSBandme G Feb. 12, 2022, 6:48 p.m. OK GNU C++17 TESTS 63 77 6656000
146189676 hotwords G Feb. 13, 2022, 3:44 a.m. OK GNU C++17 TESTS 64 77 6656000
146160601 Ra16bit G Feb. 12, 2022, 6:21 p.m. OK GNU C++17 TESTS 63 77 8396800
146179958 Atreus G Feb. 12, 2022, 11:32 p.m. OK GNU C++17 TESTS 64 77 9011200
146157624 yokozuna57 G Feb. 12, 2022, 6:02 p.m. OK GNU C++17 TESTS 63 77 9728000
146159993 Golovanov399 G Feb. 12, 2022, 6:16 p.m. OK GNU C++17 TESTS 63 93 6656000
146158465 olmrgcsi G Feb. 12, 2022, 6:06 p.m. OK GNU C++17 TESTS 63 155 31641600
146184691 wcdr G Feb. 13, 2022, 1:49 a.m. OK GNU C++17 (64) TESTS 64 30 7782400
146186621 froggyzhang G Feb. 13, 2022, 2:36 a.m. OK GNU C++17 (64) TESTS 64 31 2150400
146193632 Roundgod G Feb. 13, 2022, 4:52 a.m. OK GNU C++17 (64) TESTS 64 46 2969600
146183040 dario2994 G Feb. 13, 2022, 1:04 a.m. OK GNU C++17 (64) TESTS 64 46 4198400
146158945 Rafbill G Feb. 12, 2022, 6:09 p.m. OK GNU C++17 (64) TESTS 63 62 2355200
146149115 1004535809 G Feb. 12, 2022, 4:54 p.m. OK GNU C++17 (64) TESTS 63 62 2355200
146152469 lumibons G Feb. 12, 2022, 5:02 p.m. OK GNU C++17 (64) TESTS 63 62 5017600
146148586 kotatsugame G Feb. 12, 2022, 4:52 p.m. OK GNU C++17 (64) TESTS 63 62 7372800
146177946 Geothermal G Feb. 12, 2022, 10:35 p.m. OK GNU C++17 (64) TESTS 64 62 7782400
146158118 maroonrk G Feb. 12, 2022, 6:05 p.m. OK GNU C++17 (64) TESTS 63 78 13516800
146149904 mtsd G Feb. 12, 2022, 4:56 p.m. OK GNU C++20 (64) TESTS 63 30 2662400
146150159 never_giveup G Feb. 12, 2022, 4:56 p.m. OK GNU C++20 (64) TESTS 63 31 3788800
146168048 maximumSHOT G Feb. 12, 2022, 7:41 p.m. OK GNU C++20 (64) TESTS 63 31 4505600
146157846 BurnedChicken G Feb. 12, 2022, 6:03 p.m. OK GNU C++20 (64) TESTS 63 31 9318400
146153276 yincheng01 G Feb. 12, 2022, 5:03 p.m. OK GNU C++20 (64) TESTS 63 31 12083200
146157841 jiangly G Feb. 12, 2022, 6:03 p.m. OK GNU C++20 (64) TESTS 63 46 2457600
146182158 brunovsky G Feb. 13, 2022, 12:39 a.m. OK GNU C++20 (64) TESTS 64 46 2764800
146163994 Bambamkumar_86770 G Feb. 12, 2022, 6:53 p.m. OK GNU C++20 (64) TESTS 63 46 7168000
146184512 gxy001 G Feb. 13, 2022, 1:44 a.m. OK GNU C++20 (64) TESTS 64 46 7782400
146193112 luogu_bot3 G Feb. 13, 2022, 4:44 a.m. OK GNU C++20 (64) TESTS 64 62 2355200
146178874 arvindf232 G Feb. 12, 2022, 11:01 p.m. OK Kotlin 1.4 TESTS 64 265 14028800
146178218 arvindf232 G Feb. 12, 2022, 10:42 p.m. OK Kotlin 1.4 TESTS 64 343 16896000
146189183 whatshisbucket G Feb. 13, 2022, 3:35 a.m. OK PyPy 3 TESTS 64 296 11366400
146178090 FlakeLCR G Feb. 12, 2022, 10:38 p.m. OK PyPy 3 TESTS 64 343 30208000
146166756 Hdk2127 G Feb. 12, 2022, 7:25 p.m. OK PyPy 3-64 TESTS 63 296 27852800
146147748 nimiranio G Feb. 12, 2022, 4:50 p.m. OK PyPy 3-64 TESTS 63 451 35532800

remove filters

Back to search problems