Codeforces Round 555 (Div. 3)

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
1157 Codeforces Round 555 (Div. 3) FINISHED False 7200 181322704 April 26, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2708 ) F Maximum Balanced Circle PROGRAMMING constructive algorithms dp greedy two pointers 2300

B'There are n people in a row. The height of the i -th person is a_i . You can choose any subset of these people and try to arrange them into a balanced circle. A balanced circle is such an order of people that the difference between heights of any adjacent people is no more than 1 . For example, let heights of chosen people be [a_{i_1}, a_{i_2}, ... , a_{i_k}] , where k is the number of people you choose. Then the condition |a_{i_j} - a_{i_{j + 1}}| <= 1 should be satisfied for all j from 1 to k-1 and the condition |a_{i_1} - a_{i_k}| <= 1 should be also satisfied. |x| means the absolute value of x . It is obvious that the circle consisting of one person is balanced. Your task is to choose the maximum number of people and construct a balanced circle consisting of all chosen people. It is obvious that the circle consisting of one person is balanced so the answer always exists. The first line of the input contains one integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of people. The second line of the input contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 2 cdot 10^5 ), where a_i is the height of the i -th person. In the first line of the output print k -- the number of people in the maximum balanced circle. In the second line print k integers res_1, res_2, ... , res_k , where res_j is the height of the j -th person in the maximum balanced circle. The condition |res_{j} - res_{j + 1}| <= 1 should be satisfied for all j from 1 to k-1 and the condition |res_{1} - res_{k}| <= 1 should be also satisfied. '...

Tutorials

66737

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
53969461 about F May 10, 2019, 7:47 p.m. OK GNU C11 TESTS 40 62 819200 2300
62254202 Li-kunyang F Oct. 10, 2019, 10:17 a.m. OK GNU C11 TESTS 40 701 2457600 2300
54432063 luogu_bot1 F May 21, 2019, 12:56 a.m. OK GNU C++11 TESTS 40 31 2457600 2300
54432054 207M F May 21, 2019, 12:55 a.m. OK GNU C++11 TESTS 40 31 2457600 2300
54372591 SoiMae F May 19, 2019, 7:18 a.m. OK GNU C++11 TESTS 40 46 2457600 2300
54838175 AyoAyowei F May 30, 2019, 11:43 a.m. OK GNU C++11 TESTS 40 46 2457600 2300
55610952 ReaLNero1 F June 16, 2019, 5:41 a.m. OK GNU C++11 TESTS 40 46 2457600 2300
59560418 chenyewei_1234 F Aug. 27, 2019, 8:14 a.m. OK GNU C++11 TESTS 40 46 3276800 2300
53585784 7NationTengri F April 30, 2019, 6:26 p.m. OK GNU C++11 TESTS 40 46 4300800 2300
54372552 SoiMae F May 19, 2019, 7:17 a.m. OK GNU C++11 TESTS 40 61 2560000 2300
54234715 vjudge5 F May 16, 2019, 10:15 a.m. OK GNU C++11 TESTS 40 61 3174400 2300
54483993 Helivico F May 22, 2019, 12:16 p.m. OK GNU C++11 TESTS 40 61 4915200 2300
53491333 ambitionly F April 29, 2019, 8:52 a.m. OK GNU C++14 TESTS 40 77 819200 2300
53799190 yakamoto F May 5, 2019, 5:19 p.m. OK GNU C++14 TESTS 40 77 2457600 2300
54174511 vjudge3 F May 15, 2019, 1:12 p.m. OK GNU C++14 TESTS 40 78 819200 2300
53712244 Forever_Frivolous F May 3, 2019, 4:15 p.m. OK GNU C++14 TESTS 40 78 819200 2300
53677030 Mint_Dentifrice F May 2, 2019, 4:32 p.m. OK GNU C++14 TESTS 40 78 819200 2300
53666192 rdd6584 F May 2, 2019, 10:34 a.m. OK GNU C++14 TESTS 40 78 819200 2300
55715310 _MGH_ F June 18, 2019, 12:24 p.m. OK GNU C++14 TESTS 40 78 819200 2300
59603010 HouZAJ F Aug. 28, 2019, 7:19 a.m. OK GNU C++14 TESTS 40 78 819200 2300
53612025 lovelyx2015 F May 1, 2019, 1:36 p.m. OK GNU C++14 TESTS 40 78 1536000 2300
57901246 Acker_man F July 28, 2019, 3:46 p.m. OK GNU C++14 TESTS 40 78 1638400 2300
53485354 nickluo F April 29, 2019, 2:41 a.m. OK GNU C++17 TESTS 40 62 4505600 2300
55487608 chongryong F June 12, 2019, 8:36 a.m. OK GNU C++17 TESTS 40 77 2662400 2300
53662233 llmxby F May 2, 2019, 8:24 a.m. OK GNU C++17 TESTS 40 78 819200 2300
53498273 AlexPanda F April 29, 2019, 12:58 p.m. OK GNU C++17 TESTS 40 78 819200 2300
53677117 oridya F May 2, 2019, 4:35 p.m. OK GNU C++17 TESTS 40 78 819200 2300
64716452 how_to_become_purple F Nov. 11, 2019, 10:32 p.m. OK GNU C++17 TESTS 40 78 819200 2300
53481519 anjn98 F April 28, 2019, 8:31 p.m. OK GNU C++17 TESTS 40 78 1638400 2300
53603009 swust5120170583 F May 1, 2019, 8:48 a.m. OK GNU C++17 TESTS 40 78 3174400 2300
61589404 notanymore F Oct. 1, 2019, 6:25 a.m. OK GNU C++17 TESTS 40 78 3174400 2300
62048942 vjudge1 F Oct. 7, 2019, 8:51 a.m. OK GNU C++17 TESTS 40 78 5632000 2300
65454568 bluesky111 F Nov. 20, 2019, 7:48 p.m. OK Java 8 TESTS 40 140 0 2300
56044699 Sharon F June 25, 2019, 4:01 p.m. OK Java 8 TESTS 40 140 0 2300
53649874 Andres1 F May 1, 2019, 11:16 p.m. OK Java 8 TESTS 40 170 0 2300
57595905 dyhu083 F July 23, 2019, 1:55 p.m. OK Java 8 TESTS 40 171 6451200 2300
53611451 Nutella3000 F May 1, 2019, 1:18 p.m. OK Java 8 TESTS 40 186 3686400 2300
54802666 kusomushi F May 29, 2019, 12:38 p.m. OK Java 8 TESTS 40 186 7884800 2300
53497369 hongquanntct F April 29, 2019, 12:31 p.m. OK Java 8 TESTS 40 187 3276800 2300
57855409 Immortal1738 F July 27, 2019, 2:50 p.m. OK Java 8 TESTS 40 202 3072000 2300
53499157 tahasin F April 29, 2019, 1:24 p.m. OK Java 8 TESTS 40 202 9523200 2300
53597702 boltUsain F May 1, 2019, 5:43 a.m. OK Java 8 TESTS 40 218 13209600 2300
65468974 Spheniscine F Nov. 21, 2019, 7:32 a.m. OK Kotlin TESTS 40 187 5734400 2300
65469009 Spheniscine F Nov. 21, 2019, 7:33 a.m. OK Kotlin TESTS 40 218 5734400 2300
59681432 MathAlex F Aug. 29, 2019, 8:55 p.m. OK Kotlin TESTS 40 374 17817600 2300
56853361 sekti F July 11, 2019, 4:54 p.m. OK Kotlin TESTS 40 436 17408000 2300
53527811 CtrlAlt F April 29, 2019, 5:32 p.m. OK MS C++ 2017 TESTS 40 109 2457600 2300
56284258 xsc F June 29, 2019, 6:36 p.m. OK MS C++ 2017 TESTS 40 124 1843200 2300
53578919 2198751010 F April 30, 2019, 2:31 p.m. OK MS C++ 2017 TESTS 40 202 819200 2300
53612095 moreda F May 1, 2019, 1:38 p.m. OK MS C++ 2017 TESTS 40 265 819200 2300
54071919 shivgarg F May 13, 2019, 4:49 p.m. OK MS C++ 2017 TESTS 40 280 819200 2300
53789371 Birdy_C F May 5, 2019, 11:59 a.m. OK MS C++ 2017 TESTS 40 280 1536000 2300
53641910 AlexandrBusse F May 1, 2019, 5 p.m. OK MS C++ 2017 TESTS 40 295 1638400 2300
53642752 AlexandrBusse F May 1, 2019, 5:17 p.m. OK MS C++ 2017 TESTS 40 296 1638400 2300
65538925 GeKa F Nov. 22, 2019, 3:16 p.m. OK MS C++ 2017 TESTS 40 296 4198400 2300
53568783 tdlbw F April 30, 2019, 1:57 p.m. OK MS C++ 2017 TESTS 40 327 10240000 2300
53877925 gatsko F May 8, 2019, 1 p.m. OK PyPy 2 TESTS 40 280 22425600 2300
53766016 yfo F May 4, 2019, 11:42 p.m. OK PyPy 3 TESTS 40 545 26931200 2300
53677346 Helli.code F May 2, 2019, 4:44 p.m. OK Python 2 TESTS 40 436 17203200 2300
68042317 NocturneBflat F Jan. 1, 2020, 2:52 p.m. OK Python 3 TESTS 40 389 19558400 2300
53965865 lqtrung1998 F May 10, 2019, 4:57 p.m. OK Python 3 TESTS 40 811 15872000 2300
53656128 gion.li F May 2, 2019, 4:57 a.m. OK Python 3 TESTS 40 842 14233600 2300
53644642 AlexandrBusse F May 1, 2019, 6:11 p.m. OK Python 3 TESTS 40 888 14233600 2300
53791943 Lancern F May 5, 2019, 1:20 p.m. OK Python 3 TESTS 40 888 16179200 2300

remove filters

Back to search problems