Codeforces Round 629 (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
1328 Codeforces Round 629 (Div. 3) FINISHED False 7200 146589899 March 26, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 13286 ) D Carousel PROGRAMMING greedy math 1800

B"The round carousel consists of n figures of animals. Figures are numbered from 1 to n in order of the carousel moving. Thus, after the n -th figure the figure with the number 1 follows. Each figure has its own type -- the type of the animal corresponding to this figure (the horse, the tiger and so on). The type of animal of the i -th figure equals t_i . You want to color each figure in one of the colors. You think that it's boring if the carousel contains two different figures (with the distinct types of animals) going one right after another and colored in the same color. Your task is to color the figures in such a way that the number of distinct colors used is the minimum possible and there are no figures of the different types going one right after another and colored in the same color. If you use exactly k distinct colors, then the colors of figures should be denoted with integers from 1 to k . The input contains one or more test cases. The first line contains one integer q ( 1 <= q <= 10^4 ) -- the number of test cases in the test. Then q test cases follow. One test case is given on two lines. The first line of the test case contains one integer n ( 3 <= n <= 2 cdot 10^5 ) -- the number of figures in the carousel. Figures are numbered from 1 to n in order of carousel moving. Assume that after the n -th figure the figure 1 goes. The second line of the test case contains n integers t_1, t_2, ... , t_n ( 1 <= t_i <= 2 cdot 10^5 ), where t_i is the type of the animal of the i -th figure. The sum of n over all test cases does not exceed 2 cdot10^5 . Print q answers, for each test case print two lines. In the first line print one integer k -- the minimum possible number of distinct colors of figures. In the second line print n integers c_1, c_2, ... , c_n ( 1 <= c_i <= k ),"...

Tutorials

75246

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
74476986 ruban D March 26, 2020, 4:26 p.m. OK Delphi TESTS 10 78 33075200 1800
74475922 psaini D March 26, 2020, 4:24 p.m. OK GNU C11 TESTS 10 686 1638400 1800
74573718 SUNNY24 D March 27, 2020, 3:23 p.m. OK GNU C11 TESTS 10 686 2355200 1800
74541373 HMtaotao D March 27, 2020, 9:21 a.m. OK GNU C11 TESTS 10 702 1638400 1800
74518145 luogu_bot4 D March 27, 2020, 1:54 a.m. OK GNU C++11 TESTS 10 30 1638400 1800
74533540 luogu_bot3 D March 27, 2020, 7:14 a.m. OK GNU C++11 TESTS 10 31 819200 1800
74538067 2018liuzhiyuan D March 27, 2020, 8:42 a.m. OK GNU C++11 TESTS 10 31 1638400 1800
74524687 iyua D March 27, 2020, 4:27 a.m. OK GNU C++11 TESTS 10 31 1638400 1800
74516732 fengzhengwei D March 27, 2020, 1:12 a.m. OK GNU C++11 TESTS 10 46 0 1800
74477191 fengzhengwei D March 26, 2020, 4:26 p.m. OK GNU C++11 TESTS 10 46 0 1800
74472308 cugel D March 26, 2020, 4:18 p.m. OK GNU C++11 TESTS 10 46 204800 1800
74544122 luogu_bot5 D March 27, 2020, 9:53 a.m. OK GNU C++11 TESTS 10 46 819200 1800
74543994 suxxsfe D March 27, 2020, 9:51 a.m. OK GNU C++11 TESTS 10 46 819200 1800
74533110 luogu_bot1 D March 27, 2020, 7 a.m. OK GNU C++11 TESTS 10 46 819200 1800
74588536 vishnu_m D March 27, 2020, 6:14 p.m. OK GNU C++14 TESTS 10 61 819200 1800
74478260 AIchilajiang D March 26, 2020, 4:28 p.m. OK GNU C++14 TESTS 10 61 819200 1800
74520349 baddog D March 27, 2020, 2:53 a.m. OK GNU C++14 TESTS 10 62 819200 1800
74573351 dinesh9547 D March 27, 2020, 3:19 p.m. OK GNU C++14 TESTS 10 62 819200 1800
74539175 ted071024 D March 27, 2020, 8:55 a.m. OK GNU C++14 TESTS 10 62 819200 1800
74574972 i_returns D March 27, 2020, 3:36 p.m. OK GNU C++14 TESTS 10 62 819200 1800
74536089 I_love_you_my_girl D March 27, 2020, 8:17 a.m. OK GNU C++14 TESTS 10 62 1638400 1800
74585139 Olium_MdioxideN D March 27, 2020, 5:35 p.m. OK GNU C++14 TESTS 10 62 1638400 1800
74579219 vjudge1 D March 27, 2020, 4:25 p.m. OK GNU C++14 TESTS 10 62 1638400 1800
74536517 Rkda D March 27, 2020, 8:22 a.m. OK GNU C++14 TESTS 10 62 1638400 1800
74574695 .tx D March 27, 2020, 3:33 p.m. OK GNU C++17 TESTS 10 31 1638400 1800
74518600 _andyli D March 27, 2020, 2:08 a.m. OK GNU C++17 TESTS 10 46 3686400 1800
74515358 _andyli D March 27, 2020, 12:29 a.m. OK GNU C++17 TESTS 10 46 3686400 1800
74536401 _john_doe D March 27, 2020, 8:21 a.m. OK GNU C++17 TESTS 10 62 819200 1800
74512941 livyx D March 26, 2020, 11:11 p.m. OK GNU C++17 TESTS 10 62 819200 1800
74589536 tohe41 D March 27, 2020, 6:26 p.m. OK GNU C++17 TESTS 10 62 819200 1800
74480643 _PokerFace_ D March 26, 2020, 4:32 p.m. OK GNU C++17 TESTS 10 62 819200 1800
74484169 FlowerOfSorrow D March 26, 2020, 4:48 p.m. OK GNU C++17 TESTS 10 62 819200 1800
74571547 accwxhn D March 27, 2020, 3 p.m. OK GNU C++17 TESTS 10 62 819200 1800
74561713 shukeshukeshuke D March 27, 2020, 1:21 p.m. OK GNU C++17 TESTS 10 62 819200 1800
74514456 pseuda D March 27, 2020, 12:01 a.m. OK GNU C++17 (64) TESTS 10 46 4812800 1800
74538465 old_school D March 27, 2020, 8:47 a.m. OK GNU C++17 (64) TESTS 10 46 5836800 1800
74500431 nikitagolu8ev D March 26, 2020, 7:12 p.m. OK GNU C++17 (64) TESTS 10 61 1638400 1800
74509656 ankushkhanna D March 26, 2020, 9:39 p.m. OK GNU C++17 (64) TESTS 10 61 1638400 1800
74538818 hnust_zhoubang D March 27, 2020, 8:51 a.m. OK GNU C++17 (64) TESTS 10 61 2457600 1800
74535284 DNP D March 27, 2020, 8:06 a.m. OK GNU C++17 (64) TESTS 10 61 3174400 1800
74547310 ivan100sic D March 27, 2020, 10:27 a.m. OK GNU C++17 (64) TESTS 10 62 1638400 1800
74469735 Rahul D March 26, 2020, 4:13 p.m. OK GNU C++17 (64) TESTS 10 62 1638400 1800
74498541 alexwice D March 26, 2020, 6:48 p.m. OK GNU C++17 (64) TESTS 10 62 2457600 1800
74472843 Ari D March 26, 2020, 4:18 p.m. OK GNU C++17 (64) TESTS 10 62 2969600 1800
74500867 pohzipohzi D March 26, 2020, 7:17 p.m. OK Go TESTS 10 93 9728000 1800
74533145 synapse D March 27, 2020, 7:01 a.m. OK Go TESTS 10 124 6041600 1800
74570745 nsaeki D March 27, 2020, 2:52 p.m. OK Go TESTS 10 124 6348800 1800
74507213 anastos D March 26, 2020, 8:51 p.m. OK Haskell TESTS 10 155 25292800 1800
74471976 amsuper D March 26, 2020, 4:17 p.m. OK Haskell TESTS 10 592 37888000 1800
74468515 sarthakmanna D March 26, 2020, 4:11 p.m. OK Java 11 TESTS 10 202 14131200 1800
74560126 happy15 D March 27, 2020, 1:05 p.m. OK Java 11 TESTS 10 233 0 1800
74545241 tusharjape007 D March 27, 2020, 10:05 a.m. OK Java 11 TESTS 10 233 0 1800
74483484 atishay127 D March 26, 2020, 4:45 p.m. OK Java 11 TESTS 10 234 0 1800
74489294 Moonlit D March 26, 2020, 5:19 p.m. OK Java 11 TESTS 10 248 0 1800
74516250 kraken7 D March 27, 2020, 12:57 a.m. OK Java 11 TESTS 10 264 0 1800
74492351 jenish9599 D March 26, 2020, 5:46 p.m. OK Java 11 TESTS 10 264 6144000 1800
74483941 Comrad D March 26, 2020, 4:47 p.m. OK Java 11 TESTS 10 265 14028800 1800
74469572 GiantTornado D March 26, 2020, 4:13 p.m. OK Java 11 TESTS 10 280 8908800 1800
74588380 chris_11 D March 27, 2020, 6:12 p.m. OK Java 11 TESTS 10 311 32563200 1800
74512319 IBatJ D March 26, 2020, 10:51 p.m. OK Java 8 TESTS 10 139 0 1800
74483655 maheshwari29 D March 26, 2020, 4:46 p.m. OK Java 8 TESTS 10 140 0 1800
74544309 Hemose D March 27, 2020, 9:55 a.m. OK Java 8 TESTS 10 140 3174400 1800
74481425 Faizan D March 26, 2020, 4:33 p.m. OK Java 8 TESTS 10 155 0 1800
74485649 MubtasimShahriar D March 26, 2020, 4:57 p.m. OK Java 8 TESTS 10 155 0 1800
74486354 Samez D March 26, 2020, 5:01 p.m. OK Java 8 TESTS 10 155 2355200 1800
74482503 samer_ghaly D March 26, 2020, 4:40 p.m. OK Java 8 TESTS 10 155 2355200 1800
74495362 Omar73 D March 26, 2020, 6:14 p.m. OK Java 8 TESTS 10 155 2457600 1800
74468447 Tatsuyaaaa D March 26, 2020, 4:11 p.m. OK Java 8 TESTS 10 155 3379200 1800
74479512 Bazz D March 26, 2020, 4:30 p.m. OK Java 8 TESTS 10 155 5324800 1800
74490156 Hakiobo D March 26, 2020, 5:26 p.m. OK Kotlin TESTS 10 233 10752000 1800
74489381 Hakiobo D March 26, 2020, 5:20 p.m. OK Kotlin TESTS 10 233 10752000 1800
74558200 tokitsukaze D March 27, 2020, 12:43 p.m. OK Kotlin TESTS 10 358 17100800 1800
74470314 cmplx-xyttmt D March 26, 2020, 4:14 p.m. OK Kotlin TESTS 10 373 16179200 1800
74573793 sid9406 D March 27, 2020, 3:24 p.m. OK Kotlin TESTS 10 389 17920000 1800
74498981 sergmel D March 26, 2020, 6:53 p.m. OK Kotlin TESTS 10 1044 16588800 1800
74538944 de_loo D March 27, 2020, 8:52 a.m. OK Mono C# TESTS 10 156 23961600 1800
74519096 vjudge4 D March 27, 2020, 2:22 a.m. OK MS C++ TESTS 10 62 1638400 1800
74535588 vjudge3 D March 27, 2020, 8:11 a.m. OK MS C++ TESTS 10 109 819200 1800
74534772 vjudge5 D March 27, 2020, 8 a.m. OK MS C++ TESTS 10 186 1638400 1800
74536614 vjudge3 D March 27, 2020, 8:23 a.m. OK MS C++ TESTS 10 202 1638400 1800
74530352 vjudge1 D March 27, 2020, 6:23 a.m. OK MS C++ TESTS 10 218 1638400 1800
74589835 vjudge1 D March 27, 2020, 6:30 p.m. OK MS C++ TESTS 10 218 3993600 1800
74529699 vjudge5 D March 27, 2020, 6:14 a.m. OK MS C++ TESTS 10 234 1638400 1800
74485047 seh631638554 D March 26, 2020, 4:54 p.m. OK MS C++ TESTS 10 655 3174400 1800
74566795 vjudge5 D March 27, 2020, 2:12 p.m. OK MS C++ 2017 TESTS 10 93 819200 1800
74538990 vjudge5 D March 27, 2020, 8:53 a.m. OK MS C++ 2017 TESTS 10 93 819200 1800
74517343 vjudge4 D March 27, 2020, 1:30 a.m. OK MS C++ 2017 TESTS 10 93 819200 1800
74471578 Cube219 D March 26, 2020, 4:16 p.m. OK MS C++ 2017 TESTS 10 93 1638400 1800
74488524 itskamee D March 26, 2020, 5:14 p.m. OK MS C++ 2017 TESTS 10 187 819200 1800
74478691 dimasidorenko D March 26, 2020, 4:29 p.m. OK MS C++ 2017 TESTS 10 249 2457600 1800
74483339 keserasera_77 D March 26, 2020, 4:44 p.m. OK MS C++ 2017 TESTS 10 264 819200 1800
74545097 q8514199 D March 27, 2020, 10:03 a.m. OK MS C++ 2017 TESTS 10 265 0 1800
74483449 rhksdn6227 D March 26, 2020, 4:45 p.m. OK MS C++ 2017 TESTS 10 265 1638400 1800
74471827 Souseisaki D March 26, 2020, 4:17 p.m. OK MS C++ 2017 TESTS 10 265 1638400 1800
74506128 mayakin D March 26, 2020, 8:33 p.m. OK PHP TESTS 10 139 27340800 1800
74569844 jolt.tks D March 27, 2020, 2:42 p.m. OK PyPy 2 TESTS 10 405 15052800 1800
74474379 kabeer27 D March 26, 2020, 4:21 p.m. OK PyPy 2 TESTS 10 468 26726400 1800
74516006 peijinz D March 27, 2020, 12:50 a.m. OK PyPy 2 TESTS 10 529 15769600 1800
74500638 shehebe D March 26, 2020, 7:14 p.m. OK PyPy 2 TESTS 10 639 16793600 1800
74520672 wolffd D March 27, 2020, 3 a.m. OK PyPy 2 TESTS 10 1122 15155200 1800
74471170 anshuman16423 D March 26, 2020, 4:16 p.m. OK PyPy 2 TESTS 10 1294 18739200 1800
74487133 510030805voidf D March 26, 2020, 5:05 p.m. OK PyPy 3 TESTS 10 265 21299200 1800
74473189 keep__calm D March 26, 2020, 4:19 p.m. OK PyPy 3 TESTS 10 295 20377600 1800
74501743 Myao D March 26, 2020, 7:28 p.m. OK PyPy 3 TESTS 10 296 19968000 1800
74503504 HeavensC D March 26, 2020, 7:51 p.m. OK PyPy 3 TESTS 10 311 13004800 1800
74478194 Vedkribhu D March 26, 2020, 4:28 p.m. OK PyPy 3 TESTS 10 311 22528000 1800
74494699 jabhi_18 D March 26, 2020, 6:07 p.m. OK PyPy 3 TESTS 10 343 22528000 1800
74507049 m.ni D March 26, 2020, 8:48 p.m. OK PyPy 3 TESTS 10 358 18739200 1800
74540429 suchet0825 D March 27, 2020, 9:10 a.m. OK PyPy 3 TESTS 10 358 19148800 1800
74492030 _viru_ D March 26, 2020, 5:43 p.m. OK PyPy 3 TESTS 10 358 22220800 1800
74498109 thekushalghosh D March 26, 2020, 6:43 p.m. OK PyPy 3 TESTS 10 358 24371200 1800
74558765 Hitikkumar D March 27, 2020, 12:50 p.m. OK Python 2 TESTS 10 467 11059200 1800
74488065 bazzyadb D March 26, 2020, 5:11 p.m. OK Python 2 TESTS 10 624 11059200 1800
74543548 Vedanshu D March 27, 2020, 9:46 a.m. OK Python 3 TESTS 10 233 11059200 1800
74555122 g.juceviciute D March 27, 2020, 12:01 p.m. OK Python 3 TESTS 10 280 14233600 1800
74478264 cowbrain D March 26, 2020, 4:28 p.m. OK Python 3 TESTS 10 312 14643200 1800
74474202 BlackBear D March 26, 2020, 4:21 p.m. OK Python 3 TESTS 10 312 14643200 1800
74533747 Ksoni99 D March 27, 2020, 7:20 a.m. OK Python 3 TESTS 10 327 13721600 1800
74508104 krish237 D March 26, 2020, 9:06 p.m. OK Python 3 TESTS 10 327 13926400 1800
74508003 hidir D March 26, 2020, 9:04 p.m. OK Python 3 TESTS 10 327 14233600 1800
74590308 I__D__ D March 27, 2020, 6:35 p.m. OK Python 3 TESTS 10 327 14643200 1800
74554515 bhy_ahmed D March 27, 2020, 11:53 a.m. OK Python 3 TESTS 10 358 14643200 1800
74530171 Ueki D March 27, 2020, 6:21 a.m. OK Python 3 TESTS 10 389 15360000 1800
74502717 sansen D March 26, 2020, 7:41 p.m. OK Rust TESTS 10 62 5427200 1800
74496249 mversic101 D March 26, 2020, 6:23 p.m. OK Rust TESTS 10 265 4608000 1800
74521375 BadDuck D March 27, 2020, 3:15 a.m. OK Scala TESTS 10 655 7168000 1800

remove filters

Back to search problems