Codeforces Round 490 (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
999 Codeforces Round 490 (Div. 3) FINISHED False 7200 207933923 June 21, 2018, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 4464 ) D Equalize the Remainders PROGRAMMING data structures greedy implementation 1900

B"You are given an array consisting of n integers a_1, a_2, ... , a_n , and a positive integer m . It is guaranteed that m is a divisor of n . In a single move, you can choose any position i between 1 and n and increase a_i by 1 . Let's calculate c_r ( 0 <= r <= m-1) -- the number of elements having remainder r when divided by m . In other words, for each remainder, let's find the number of corresponding elements in a with that remainder. Your task is to change the array in such a way that c_0 = c_1 = ... = c_{m-1} = frac{n}{m} . Find the minimum number of moves to satisfy the above requirement. The first line of input contains two integers n and m ( 1 <= n <= 2 cdot 10^5, 1 <= m <= n ). It is guaranteed that m is a divisor of n . The second line of input contains n integers a_1, a_2, ... , a_n ( 0 <= a_i <= 10^9 ), the elements of the array. In the first line, print a single integer -- the minimum number of moves required to satisfy the following condition: for each remainder from 0 to m - 1 , the number of elements of the array having this remainder equals frac{n}{m} . In the second line, print any array satisfying the condition and can be obtained from the given array with the minimum number of moves. The values of the elements of the resulting array must not exceed 10^{18} . "...

Tutorials

60138

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
68681350 rr_ D Jan. 12, 2020, 10:31 p.m. OK D TESTS 47 186 39424000 1900
39522633 veiveim D June 22, 2018, 4:47 p.m. OK GNU C TESTS 47 109 5632000 1900
39893610 appleeated D July 3, 2018, 12:28 p.m. OK GNU C TESTS 47 124 5632000 1900
41211290 Scut82 D Aug. 4, 2018, 10:48 a.m. OK GNU C++ TESTS 47 62 7680000 1900
41211500 Scut82 D Aug. 4, 2018, 10:54 a.m. OK GNU C++ TESTS 47 62 15564800 1900
39535843 zgyw D June 23, 2018, 8:16 a.m. OK GNU C++ TESTS 47 93 7987200 1900
39649243 lhylhy D June 25, 2018, 12:23 p.m. OK GNU C++ TESTS 47 109 4812800 1900
39669224 luogu_bot4 D June 26, 2018, 8:01 a.m. OK GNU C++ TESTS 47 109 5427200 1900
39541595 luogu_bot3 D June 23, 2018, 12:39 p.m. OK GNU C++ TESTS 47 109 9113600 1900
40529773 fxt D July 19, 2018, 1:51 a.m. OK GNU C++ TESTS 47 109 9216000 1900
39636958 RobertZhao1101 D June 25, 2018, 3:25 a.m. OK GNU C++ TESTS 47 124 5632000 1900
39959766 Scut82 D July 4, 2018, 3:19 p.m. OK GNU C++ TESTS 47 124 9625600 1900
41960126 vjudge4 D Aug. 22, 2018, 8:57 a.m. OK GNU C++ TESTS 47 124 19251200 1900
40169102 AkaneSasu D July 10, 2018, 11:34 a.m. OK GNU C++11 TESTS 47 78 6963200 1900
66317591 vjudge4 D Dec. 5, 2019, 1:30 p.m. OK GNU C++11 TESTS 47 93 3174400 1900
66317495 Wangxuye D Dec. 5, 2019, 1:28 p.m. OK GNU C++11 TESTS 47 93 3174400 1900
40168098 AkaneSasu D July 10, 2018, 11:07 a.m. OK GNU C++11 TESTS 47 93 7782400 1900
65658334 vjudge5 D Nov. 24, 2019, 11:23 a.m. OK GNU C++11 TESTS 47 93 9625600 1900
61947186 _AI D Oct. 6, 2019, 12:53 a.m. OK GNU C++11 TESTS 47 93 12800000 1900
61947122 _AI D Oct. 6, 2019, 12:49 a.m. OK GNU C++11 TESTS 47 93 12800000 1900
39676510 changxv D June 26, 2018, 1:17 p.m. OK GNU C++11 TESTS 47 93 42598400 1900
45171344 LiuRunkY D Nov. 1, 2018, 12:59 p.m. OK GNU C++11 TESTS 47 109 3686400 1900
61946328 xiaobing D Oct. 5, 2019, 11:44 p.m. OK GNU C++11 TESTS 47 109 5632000 1900
39514052 Alexit D June 22, 2018, 10:56 a.m. OK GNU C++14 TESTS 47 62 11161600 1900
39514071 Alexit D June 22, 2018, 10:57 a.m. OK GNU C++14 TESTS 47 77 11980800 1900
39513419 Alexit D June 22, 2018, 10:32 a.m. OK GNU C++14 TESTS 47 78 9113600 1900
39513532 Alexit D June 22, 2018, 10:36 a.m. OK GNU C++14 TESTS 47 93 9113600 1900
39515579 mayi_is_the_most_lovely D June 22, 2018, 11:55 a.m. OK GNU C++14 TESTS 47 108 9318400 1900
39516332 maomaozhengxiang D June 22, 2018, 12:26 p.m. OK GNU C++14 TESTS 47 124 5632000 1900
45915180 henu_16l_lxl D Nov. 18, 2018, 1:38 p.m. OK GNU C++14 TESTS 47 124 6451200 1900
39511380 stefdasca D June 22, 2018, 9:21 a.m. OK GNU C++14 TESTS 47 124 6553600 1900
39516001 MeePwn D June 22, 2018, 12:12 p.m. OK GNU C++14 TESTS 47 124 6860800 1900
41870774 .amitt D Aug. 19, 2018, 6:24 p.m. OK GNU C++14 TESTS 47 124 7680000 1900
39544156 CrafterKolyan D June 23, 2018, 2:47 p.m. OK GNU C++17 TESTS 47 124 3174400 1900
51838115 MOPKOBKA228 D March 25, 2019, 7:31 p.m. OK GNU C++17 TESTS 47 124 3993600 1900
46251983 Mohamed.Sobhy D Nov. 26, 2018, 2:36 p.m. OK GNU C++17 TESTS 47 124 3993600 1900
39523679 intersection.pro D June 22, 2018, 5:29 p.m. OK GNU C++17 TESTS 47 124 3993600 1900
41294222 ccdxc D Aug. 7, 2018, 6:08 a.m. OK GNU C++17 TESTS 47 124 5632000 1900
51981798 DystoriaX D March 29, 2019, 4:39 p.m. OK GNU C++17 TESTS 47 124 6348800 1900
45980339 156302 D Nov. 19, 2018, 10:24 p.m. OK GNU C++17 TESTS 47 124 6451200 1900
67941406 lhnrichy D Dec. 30, 2019, 1:18 a.m. OK GNU C++17 TESTS 47 124 8499200 1900
40505281 duyi D July 18, 2018, 8:05 a.m. OK GNU C++17 TESTS 47 124 8704000 1900
41667474 ladyjy D Aug. 17, 2018, 1:25 a.m. OK GNU C++17 TESTS 47 124 9318400 1900
67137267 vjudge2 D Dec. 18, 2019, 4:59 a.m. OK Go TESTS 47 888 13414400 1900
67137227 WangJialei D Dec. 18, 2019, 4:59 a.m. OK Go TESTS 47 904 13414400 1900
42739207 Marii D Sept. 10, 2018, 3:18 p.m. OK Go TESTS 47 1045 35532800 1900
68960568 GiantTornado D Jan. 17, 2020, 12:16 a.m. OK Java 11 TESTS 47 638 44748800 1900
69564021 luchy0120 D Jan. 26, 2020, 11:43 a.m. OK Java 8 TESTS 47 234 17305600 1900
60370099 bleh0.5 D Sept. 11, 2019, 12:49 a.m. OK Java 8 TESTS 47 280 13107200 1900
39649845 kunalk D June 25, 2018, 12:49 p.m. OK Java 8 TESTS 47 296 0 1900
51907789 Krimpai D March 27, 2019, 4:29 p.m. OK Java 8 TESTS 47 311 26521600 1900
39700446 Sandip_Jana D June 27, 2018, 11:53 a.m. OK Java 8 TESTS 47 327 14438400 1900
39863685 megaspazz D July 2, 2018, 9:37 a.m. OK Java 8 TESTS 47 327 17203200 1900
54276006 hasan5788 D May 17, 2019, 11:11 a.m. OK Java 8 TESTS 47 327 18636800 1900
39533461 rahejamehul D June 23, 2018, 6:11 a.m. OK Java 8 TESTS 47 327 46489600 1900
39701940 linners D June 27, 2018, 12:53 p.m. OK Java 8 TESTS 47 343 14336000 1900
39646182 trycodeforfun111 D June 25, 2018, 10:20 a.m. OK Java 8 TESTS 47 343 27033600 1900
67699688 hibatibati D Dec. 27, 2019, 2:04 p.m. OK Mono C# TESTS 47 233 44646400 1900
39517792 DMN D June 22, 2018, 1:28 p.m. OK Mono C# TESTS 47 311 38707200 1900
39517853 DMN D June 22, 2018, 1:30 p.m. OK Mono C# TESTS 47 358 43110400 1900
39895298 Anastasiya_Andreevna D July 3, 2018, 1:33 p.m. OK Mono C# TESTS 47 826 53248000 1900
39895246 Anastasiya_Andreevna D July 3, 2018, 1:31 p.m. OK Mono C# TESTS 47 842 56832000 1900
40931716 ReaLNero1 D July 30, 2018, 1:16 a.m. OK MS C++ TESTS 47 46 4096000 1900
39513902 lxn D June 22, 2018, 10:50 a.m. OK MS C++ TESTS 47 46 4096000 1900
39512245 lxn D June 22, 2018, 9:52 a.m. OK MS C++ TESTS 47 62 4300800 1900
44776554 vjudge2 D Oct. 24, 2018, 2:36 p.m. OK MS C++ TESTS 47 124 9830400 1900
41626472 scorpiowf D Aug. 15, 2018, 2:45 p.m. OK MS C++ TESTS 47 140 4300800 1900
53084833 vjudge5 D April 21, 2019, 8:27 a.m. OK MS C++ TESTS 47 140 11264000 1900
63757832 vjudge2 D Oct. 30, 2019, 1:10 a.m. OK MS C++ TESTS 47 140 11264000 1900
44617441 vjudge4 D Oct. 21, 2018, 3:15 a.m. OK MS C++ TESTS 47 155 7987200 1900
40670823 vjudge4 D July 23, 2018, 12:30 p.m. OK MS C++ TESTS 47 155 12185600 1900
53218878 vjudge5 D April 24, 2019, 10:42 a.m. OK MS C++ TESTS 47 156 11264000 1900
62768704 AleksanderBalobanov D Oct. 17, 2019, 9:31 a.m. OK MS C++ 2017 TESTS 47 187 43622400 1900
50675978 work_hard. D March 2, 2019, 9:17 a.m. OK MS C++ 2017 TESTS 47 202 8806400 1900
56938107 CtrlAlt D July 12, 2019, 6:04 p.m. OK MS C++ 2017 TESTS 47 1465 15462400 1900
60740244 ssk497 D Sept. 17, 2019, 7:35 p.m. OK PyPy 2 TESTS 47 1403 29593600 1900
56937460 smirnovalX D July 12, 2019, 5:14 p.m. OK PyPy 2 TESTS 47 2885 20787200 1900
53589592 yfo D April 30, 2019, 9:31 p.m. OK PyPy 3 TESTS 47 514 46796800 1900
46093556 LordVader D Nov. 22, 2018, 9:05 p.m. OK PyPy 3 TESTS 47 639 57344000 1900
39520472 inishchith. D June 22, 2018, 3:24 p.m. OK PyPy 3 TESTS 47 655 26726400 1900
39513006 kevinsogo D June 22, 2018, 10:17 a.m. OK PyPy 3 TESTS 47 655 27033600 1900
67064589 GTrigger D Dec. 17, 2019, 10:36 a.m. OK PyPy 3 TESTS 47 733 27648000 1900
68889088 mth1908 D Jan. 16, 2020, 12:57 a.m. OK PyPy 3 TESTS 47 904 91136000 1900
39680683 yoshi74ls181 D June 26, 2018, 4:17 p.m. OK PyPy 3 TESTS 47 1107 92057600 1900
39679607 Ali_Pi D June 26, 2018, 3:28 p.m. OK Python 2 TESTS 47 639 29388800 1900
39621031 SoSooding D June 24, 2018, 5:35 p.m. OK Python 2 TESTS 47 966 36044800 1900
39533142 Olexiy D June 23, 2018, 5:52 a.m. OK Python 2 TESTS 47 982 33075200 1900
39592389 mihir_94 D June 24, 2018, 6:45 a.m. OK Python 2 TESTS 47 1045 36761600 1900
39539687 bary D June 23, 2018, 11:17 a.m. OK Python 2 TESTS 47 1107 25600000 1900
52501180 aleonov D April 8, 2019, 4:10 p.m. OK Python 3 TESTS 47 608 34201600 1900
51808026 lucasq D March 25, 2019, 1:12 a.m. OK Python 3 TESTS 47 623 34201600 1900
39648268 orailly D June 25, 2018, 11:47 a.m. OK Python 3 TESTS 47 686 33894400 1900
39645191 orailly D June 25, 2018, 9:42 a.m. OK Python 3 TESTS 47 857 44236800 1900
39521447 dpforest D June 22, 2018, 4:02 p.m. OK Python 3 TESTS 47 982 48640000 1900
48358280 nani_7 D Jan. 13, 2019, 5:32 p.m. OK Python 3 TESTS 47 1013 24473600 1900
56938224 al_bus D July 12, 2019, 6:11 p.m. OK Python 3 TESTS 47 1013 41574400 1900
48358756 nani_7 D Jan. 13, 2019, 5:55 p.m. OK Python 3 TESTS 47 1185 29184000 1900
48044859 TurningTables D Jan. 7, 2019, 12:54 a.m. OK Python 3 TESTS 47 1263 29081600 1900
39607519 MaxHo D June 24, 2018, 4 p.m. OK Python 3 TESTS 47 1310 33689600 1900

remove filters

Back to search problems