Codeforces Round 904 (Div. 2)

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
1884 Codeforces Round 904 (Div. 2) FINISHED False 7200 33864899 Oct. 22, 2023, 7:05 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 322 ) E Hard Design PROGRAMMING implementation

B'Consider an array of integers b_0, b_1, ldots, b_{n-1} . Your goal is to make all its elements equal. To do so, you can perform the following operation several (possibly, zero) times: The value f(b) is defined as a pair of integers (cnt, cost) , where cnt is the smallest number of operations required to make all elements of the array equal, and cost is the largest total number of coins you can receive among all possible ways to make all elements equal within cnt operations. In other words, first, you need to minimize the number of operations, second, you need to maximize the total number of coins you receive. You are given an array of integers a_0, a_1, ldots, a_{n-1} . Please, find the value of f for all cyclic shifts of a . Formally, for each 0 <= i <= n-1 you need to do the following: Please note that under a fixed cnt you need to maximize the total number of coins cost , not its remainder modulo (10^9 + 7) . Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 2 cdot 10^4 ). The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 10^6 ). The second line of each test case contains n integers a_0, a_1, ldots, a_{n-1} ( 1 <= a_i <= 10^9 ). It is guaranteed that the sum of n over all test cases does not exceed 10^6 . For each test case, for each 0 <= i <= n-1 output the value of f for the i -th cyclic shift of array a : first, output cnt (the minimum number of operations), then output cost (the maximum number of coins these operations can give) modulo 10^9 + 7 . In the first test case, there is only one cycle shift, which is equal to [1] , and all its elements are already equal. In the second test case, you need to find the answer for three arrays: Consider the case of ['...

Tutorials

Codeforces Round #904 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
229197724 liuhangxin E Oct. 22, 2023, 10:08 a.m. OK GNU C++14 TESTS 13 919 80179200
229197594 liuhangxin E Oct. 22, 2023, 10:07 a.m. OK GNU C++14 TESTS 13 1029 96153600
229366024 yanghanyv E Oct. 23, 2023, 4:02 a.m. OK GNU C++14 TESTS 13 1107 64102400
229363410 sunzz3183 E Oct. 23, 2023, 3:16 a.m. OK GNU C++14 TESTS 13 1169 104960000
229365149 sunzz3183 E Oct. 23, 2023, 3:46 a.m. OK GNU C++14 TESTS 13 1185 104960000
229192097 fyable E Oct. 22, 2023, 9:26 a.m. OK GNU C++14 TESTS 13 1200 72192000
229195939 awoo E Oct. 22, 2023, 9:53 a.m. OK GNU C++14 TESTS 13 1762 226611200
229196196 SHADOW323 E Oct. 22, 2023, 9:55 a.m. OK GNU C++17 TESTS 13 1076 22425600
229191046 Rozemyne E Oct. 22, 2023, 9:20 a.m. OK GNU C++17 TESTS 13 1123 68096000
229172826 prvocislo E Oct. 22, 2023, 8:07 a.m. OK GNU C++17 TESTS 13 1138 88268800
229190934 Pyqe E Oct. 22, 2023, 9:19 a.m. OK GNU C++17 TESTS 13 1154 48128000
229176279 Forested E Oct. 22, 2023, 8:18 a.m. OK GNU C++17 TESTS 13 1263 82432000
229196967 zlc1114 E Oct. 22, 2023, 10:02 a.m. OK GNU C++17 TESTS 13 1419 163123200
229193145 libobil E Oct. 22, 2023, 9:32 a.m. OK GNU C++17 TESTS 13 1481 145510400
229192547 orzdevinwang E Oct. 22, 2023, 9:29 a.m. OK GNU C++17 (64) TESTS 13 639 32051200
229310838 YocyCraft E Oct. 22, 2023, 3:42 p.m. OK GNU C++17 (64) TESTS 13 717 84787200
229354354 enslaved E Oct. 22, 2023, 11:37 p.m. OK GNU C++17 (64) TESTS 13 733 82022400
229334267 rniya E Oct. 22, 2023, 7:10 p.m. OK GNU C++17 (64) TESTS 13 841 119603200
229354861 Yu_Jie E Oct. 22, 2023, 11:54 p.m. OK GNU C++17 (64) TESTS 13 1356 48128000
229203580 namelessgugugu E Oct. 22, 2023, 11:02 a.m. OK GNU C++17 (64) TESTS 13 1762 37785600
229179014 tute7627 E Oct. 22, 2023, 8:27 a.m. OK GNU C++17 (64) TESTS 13 1762 170905600
229352464 chappy1 E Oct. 22, 2023, 10:36 p.m. OK GNU C++17 (64) TESTS 13 1871 169472000
229203490 max67 E Oct. 22, 2023, 11:01 a.m. OK GNU C++17 (64) TESTS 13 1949 169472000
229175578 kotatsugame E Oct. 22, 2023, 8:16 a.m. OK GNU C++17 (64) TESTS 13 2698 148172800
229353062 BuddhaBarFans E Oct. 22, 2023, 10:52 p.m. OK GNU C++20 (64) TESTS 13 452 23449600
229295938 huangpj E Oct. 22, 2023, 2:01 p.m. OK GNU C++20 (64) TESTS 13 467 23449600
229192488 Andrey23 E Oct. 22, 2023, 9:28 a.m. OK GNU C++20 (64) TESTS 13 467 23449600
229202314 ikrpprppp E Oct. 22, 2023, 10:50 a.m. OK GNU C++20 (64) TESTS 13 483 83046400
229184537 negative1 E Oct. 22, 2023, 8:48 a.m. OK GNU C++20 (64) TESTS 13 498 80179200
229191226 ElDiablo E Oct. 22, 2023, 9:21 a.m. OK GNU C++20 (64) TESTS 13 498 85094400
229193527 monkeyswithmoney E Oct. 22, 2023, 9:35 a.m. OK GNU C++20 (64) TESTS 13 514 30822400
229193234 hzk_cpp E Oct. 22, 2023, 9:33 a.m. OK GNU C++20 (64) TESTS 13 514 75366400
229193161 -0v0- E Oct. 22, 2023, 9:33 a.m. OK GNU C++20 (64) TESTS 13 514 75366400
229196783 Emotiona E Oct. 22, 2023, 10 a.m. OK GNU C++20 (64) TESTS 13 514 77824000

remove filters

Back to search problems