Divide by Zero 2021 and Codeforces Round 714 (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
1513 Divide by Zero 2021 and Codeforces Round 714 (Div. 2) FINISHED False 7200 119114663 April 11, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1543 ) E Cost Equilibrium PROGRAMMING combinatorics constructive algorithms math sortings

B'An array is called beautiful if all the elements in the array are equal. You can transform an array using the following steps any number of times: For example, array [0, 2, 3, 3] can be transformed into a beautiful array [2, 2, 2, 2] with total cost 1 cdot |1-3| + 1 cdot |1-4| = 5 . An array is called balanced, if it can be transformed into a beautiful array, and the cost of such transformation is uniquely defined. In other words, the minimum cost of transformation into a beautiful array equals the maximum cost. You are given an array a_1, a_2, ldots, a_n of length n , consisting of non-negative integers. Your task is to find the number of balanced arrays which are permutations of the given array. Two arrays are considered different, if elements at some position differ. Since the answer can be large, output it modulo 10^9 + 7 . The first line contains a single integer n ( 1 <= q n <= q 10^5 ) -- the size of the array. The second line contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= 10^9 ). Output a single integer -- the number of balanced permutations modulo 10^9+7 . In the first example, [1, 2, 3] is a valid permutation as we can consider the index with value 3 as the source and index with value 1 as the sink. Thus, after conversion we get a beautiful array [2, 2, 2] , and the total cost would be 2 . We can show that this is the only transformation of this array that leads to a beautiful array. Similarly, we can check for other permutations too. In the second example, [0, 0, 4, 4] and [4, 4, 0, 0] are balanced permutations. In the third example, all permutations are balanced. '...

Tutorials

Divide by Zero 2021 and Codeforces Round #714 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
112704618 darkflamehxy E April 11, 2021, 4:20 p.m. OK GNU C++11 TESTS 58 46 2048000
112732070 __23333 E April 12, 2021, 12:14 a.m. OK GNU C++11 TESTS 58 46 6758400
112712763 Darko1227 E April 11, 2021, 5:14 p.m. OK GNU C++11 TESTS 58 62 3993600
112740521 Ideal_End E April 12, 2021, 2:53 a.m. OK GNU C++11 TESTS 58 62 4403200
112722713 Baraa_Armoush E April 11, 2021, 7:18 p.m. OK GNU C++11 TESTS 58 62 4505600
112744783 yang12138 E April 12, 2021, 4:29 a.m. OK GNU C++11 TESTS 58 62 6860800
112731908 zech E April 12, 2021, 12:06 a.m. OK GNU C++11 TESTS 58 62 9625600
112734057 mao_zx E April 12, 2021, 1:44 a.m. OK GNU C++11 TESTS 58 77 6451200
112707225 CRJ_ZCR E April 11, 2021, 4:28 p.m. OK GNU C++11 TESTS 58 78 2867200
112741761 rk_no E April 12, 2021, 3:25 a.m. OK GNU C++11 TESTS 58 78 3584000
112749655 iNx E April 12, 2021, 5:51 a.m. OK GNU C++14 TESTS 58 62 2457600
112742002 fractal E April 12, 2021, 3:30 a.m. OK GNU C++14 TESTS 58 62 2457600
112726055 jainbot27 E April 11, 2021, 8:21 p.m. OK GNU C++14 TESTS 58 77 6246400
112746034 LushCat E April 12, 2021, 4:52 a.m. OK GNU C++14 TESTS 58 77 6963200
112725693 viego E April 11, 2021, 8:13 p.m. OK GNU C++14 TESTS 58 78 4198400
112726035 viego E April 11, 2021, 8:21 p.m. OK GNU C++14 TESTS 58 78 4198400
112707632 HanTroid E April 11, 2021, 4:29 p.m. OK GNU C++14 TESTS 58 78 5427200
112743004 George1123 E April 12, 2021, 3:51 a.m. OK GNU C++14 TESTS 58 93 1228800
112713474 farmerboy E April 11, 2021, 5:19 p.m. OK GNU C++14 TESTS 58 93 2764800
112705178 mcfr E April 11, 2021, 4:22 p.m. OK GNU C++14 TESTS 58 93 5632000
112741611 platelets E April 12, 2021, 3:22 a.m. OK GNU C++17 TESTS 58 61 819200
112732548 Turkey E April 12, 2021, 12:39 a.m. OK GNU C++17 TESTS 58 62 1228800
112701803 CLDP E April 11, 2021, 4:11 p.m. OK GNU C++17 TESTS 58 62 2457600
112745008 Adam_pxx E April 12, 2021, 4:33 a.m. OK GNU C++17 TESTS 58 62 2457600
112705140 cuiaoxiang E April 11, 2021, 4:22 p.m. OK GNU C++17 TESTS 58 62 2764800
112750507 Yzm007 E April 12, 2021, 6:04 a.m. OK GNU C++17 TESTS 58 62 2969600
112732552 ELT_AW E April 12, 2021, 12:39 a.m. OK GNU C++17 TESTS 58 62 3993600
112750197 7KIRA1999 E April 12, 2021, 5:59 a.m. OK GNU C++17 TESTS 58 62 6348800
112724073 Final_Masquerade E April 11, 2021, 7:41 p.m. OK GNU C++17 TESTS 58 62 7065600
112702470 zufius E April 11, 2021, 4:13 p.m. OK GNU C++17 TESTS 58 77 3481600
112721233 the_hyp0cr1t3 E April 11, 2021, 6:54 p.m. OK GNU C++17 (64) TESTS 58 46 1638400
112733672 tomato_potato E April 12, 2021, 1:29 a.m. OK GNU C++17 (64) TESTS 58 46 2048000
112748845 DQ9911 E April 12, 2021, 5:38 a.m. OK GNU C++17 (64) TESTS 58 46 2355200
112705867 Narut E April 11, 2021, 4:24 p.m. OK GNU C++17 (64) TESTS 58 62 1228800
112711261 erray E April 11, 2021, 5:05 p.m. OK GNU C++17 (64) TESTS 58 62 4096000
112722606 Dragnoid99 E April 11, 2021, 7:16 p.m. OK GNU C++17 (64) TESTS 58 62 4710400
112707557 madhav_1999 E April 11, 2021, 4:29 p.m. OK GNU C++17 (64) TESTS 58 62 5529600
112737220 nnm_shiraha E April 12, 2021, 2:17 a.m. OK GNU C++17 (64) TESTS 58 62 5734400
112725311 4.5Tatami E April 11, 2021, 8:06 p.m. OK GNU C++17 (64) TESTS 58 62 6246400
112714548 gokul.raj E April 11, 2021, 5:30 p.m. OK GNU C++17 (64) TESTS 58 62 7372800
112728946 dauom E April 11, 2021, 9:42 p.m. OK Java 11 TESTS 58 218 0
112711467 bobib E April 11, 2021, 5:06 p.m. OK Java 11 TESTS 58 327 2048000
112704497 SecondThread E April 11, 2021, 4:20 p.m. OK Java 11 TESTS 58 514 8089600
112708400 golions E April 11, 2021, 4:31 p.m. OK Java 8 TESTS 58 233 6041600
112714105 TheSawan E April 11, 2021, 5:25 p.m. OK Java 8 TESTS 58 327 5120000
112715165 koper E April 11, 2021, 5:36 p.m. OK Kotlin TESTS 58 421 6144000
112729701 grey E April 11, 2021, 10:09 p.m. OK MS C++ 2017 TESTS 58 139 2662400
112703437 Yupiteru E April 11, 2021, 4:16 p.m. OK .NET Core C# TESTS 58 155 18739200
112702920 EmK E April 11, 2021, 4:15 p.m. OK .NET Core C# TESTS 58 186 14643200
112716343 FireBird23 E April 11, 2021, 5:49 p.m. OK PyPy 3 TESTS 58 265 26521600
112744503 Genius3435 E April 12, 2021, 4:24 a.m. OK PyPy 3 TESTS 58 311 17305600
112744389 Genius3435 E April 12, 2021, 4:21 a.m. OK PyPy 3 TESTS 58 311 17408000
112744435 Genius3435 E April 12, 2021, 4:22 a.m. OK PyPy 3 TESTS 58 312 17203200
112713231 titia E April 11, 2021, 5:18 p.m. OK PyPy 3 TESTS 58 421 39321600
112717307 jimm89 E April 11, 2021, 6 p.m. OK PyPy 3 TESTS 58 436 23654400
112729093 EPrebet E April 11, 2021, 9:47 p.m. OK PyPy 3 TESTS 58 514 22630400
112707369 chinerist E April 11, 2021, 4:29 p.m. OK PyPy 3 TESTS 58 842 59494400

remove filters

Back to search problems