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.
Problems
B"Highway 201 is the most busy street in Rockport. Traffic cars cause a lot of hindrances to races, especially when there are a lot of them. The track which passes through this highway can be divided into n sub-tracks. You are given an array a where a_i represents the number of traffic cars in the i -th sub-track. You define the inconvenience of the track as sum limits_{i=1}^{n} sum limits_{j=i+1}^{n} lvert a_i-a_j rvert , where |x| is the absolute value of x . You can perform the following operation any (possibly zero) number of times: choose a traffic car and move it from its current sub-track to any other sub-track. Find the minimum inconvenience you can achieve. The first line of input contains a single integer t ( 1 <= q t <= q 10 ,000 ) -- the number of test cases. The first line of each test case contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ). The second line of each test case contains n integers a_1, a_2, ldots, a_n ( 0 <= q a_i <= q 10^9 ). It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, print a single line containing a single integer: the minimum inconvenience you can achieve by applying the given operation any (possibly zero) number of times. For the first test case, you can move a car from the 3 -rd sub-track to the 1 -st sub-track to obtain 0 inconvenience. For the second test case, moving any car won't decrease the inconvenience of the track. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
121657411 |
bnurgeldiyev514 |
B |
July 7, 2021, 7:01 p.m. |
OK |
GNU C11 |
TESTS |
22 |
61 |
819200 |
|
|
121672732 |
patil98varad |
B |
July 8, 2021, 2 a.m. |
OK |
GNU C11 |
TESTS |
22 |
62 |
1638400 |
|
|
121642512 |
__rahul005 |
B |
July 7, 2021, 4:36 p.m. |
OK |
GNU C11 |
TESTS |
22 |
77 |
1638400 |
|
|
121642026 |
AESTRIX |
B |
July 7, 2021, 4:35 p.m. |
OK |
GNU C11 |
TESTS |
22 |
78 |
1638400 |
|
|
121672866 |
patil98varad |
B |
July 8, 2021, 2:04 a.m. |
OK |
GNU C11 |
TESTS |
22 |
78 |
1638400 |
|
|
121678463 |
FoXreign |
B |
July 8, 2021, 3:52 a.m. |
OK |
GNU C++11 |
TESTS |
22 |
31 |
0 |
|
|
121656814 |
Aisoipheo |
B |
July 7, 2021, 6:54 p.m. |
OK |
GNU C++11 |
TESTS |
22 |
31 |
102400 |
|
|
121656882 |
Aisoipheo |
B |
July 7, 2021, 6:55 p.m. |
OK |
GNU C++11 |
TESTS |
22 |
31 |
102400 |
|
|
121669388 |
changle_cyx |
B |
July 8, 2021, 12:25 a.m. |
OK |
GNU C++11 |
TESTS |
22 |
31 |
819200 |
|
|
121669785 |
zrr12138 |
B |
July 8, 2021, 12:42 a.m. |
OK |
GNU C++11 |
TESTS |
22 |
31 |
1638400 |
|
|
121674346 |
xzpq |
B |
July 8, 2021, 2:37 a.m. |
OK |
GNU C++11 |
TESTS |
22 |
31 |
1638400 |
|
|
121671824 |
never_stop_rating |
B |
July 8, 2021, 1:40 a.m. |
OK |
GNU C++11 |
TESTS |
22 |
31 |
7987200 |
|
|
121671074 |
yiwangzhifeng |
B |
July 8, 2021, 1:21 a.m. |
OK |
GNU C++11 |
TESTS |
22 |
46 |
0 |
|
|
121669800 |
E-ray |
B |
July 8, 2021, 12:42 a.m. |
OK |
GNU C++11 |
TESTS |
22 |
46 |
0 |
|
|
121659105 |
fishcathu. |
B |
July 7, 2021, 7:24 p.m. |
OK |
GNU C++11 |
TESTS |
22 |
46 |
0 |
|
|
121678385 |
spek |
B |
July 8, 2021, 3:50 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
0 |
|
|
121675755 |
SF-Manman |
B |
July 8, 2021, 3:04 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
0 |
|
|
121669613 |
saurav747 |
B |
July 8, 2021, 12:34 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
0 |
|
|
121663531 |
EntropyX |
B |
July 7, 2021, 8:49 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
0 |
|
|
121686611 |
Hantek |
B |
July 8, 2021, 5:50 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
0 |
|
|
121677996 |
ss_fb |
B |
July 8, 2021, 3:43 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
819200 |
|
|
121657068 |
2687052072 |
B |
July 7, 2021, 6:57 p.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
1536000 |
|
|
121684717 |
vinay_2000 |
B |
July 8, 2021, 5:28 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
1638400 |
|
|
121671220 |
rahulkumar12345 |
B |
July 8, 2021, 1:25 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
1638400 |
|
|
121675753 |
archana_24 |
B |
July 8, 2021, 3:04 a.m. |
OK |
GNU C++14 |
TESTS |
22 |
62 |
1638400 |
|
|
121671112 |
kamer |
B |
July 8, 2021, 1:22 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
0 |
|
|
121684568 |
Secret_Superstar12 |
B |
July 8, 2021, 5:25 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
0 |
|
|
121686551 |
codingvampire |
B |
July 8, 2021, 5:49 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
0 |
|
|
121668787 |
jitendrapranto |
B |
July 8, 2021, 12:01 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
819200 |
|
|
121684187 |
sudhanshunautiyal777 |
B |
July 8, 2021, 5:21 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
819200 |
|
|
121675212 |
rajkumar62506 |
B |
July 8, 2021, 2:54 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
819200 |
|
|
121666644 |
jpcm2 |
B |
July 7, 2021, 10:27 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
819200 |
|
|
121664598 |
rachitb05 |
B |
July 7, 2021, 9:18 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
819200 |
|
|
121653093 |
jestinroy3 |
B |
July 7, 2021, 6:20 p.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
819200 |
|
|
121684149 |
be_humble |
B |
July 8, 2021, 5:21 a.m. |
OK |
GNU C++17 |
TESTS |
22 |
62 |
1638400 |
|
|
121668557 |
Akib_2612 |
B |
July 7, 2021, 11:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121665593 |
Svlad_Cjelli |
B |
July 7, 2021, 9:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121664972 |
Nah1d |
B |
July 7, 2021, 9:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121653282 |
zhuuxa |
B |
July 7, 2021, 6:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121671052 |
cheissmart |
B |
July 8, 2021, 1:20 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121677367 |
isheoran |
B |
July 8, 2021, 3:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121682141 |
12662 |
B |
July 8, 2021, 4:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121682825 |
follen |
B |
July 8, 2021, 5:03 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121669911 |
dblark |
B |
July 8, 2021, 12:46 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
0 |
|
|
121687160 |
PaliLo |
B |
July 8, 2021, 5:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
22 |
46 |
819200 |
|
|
121662619 |
gourav02 |
B |
July 7, 2021, 8:29 p.m. |
OK |
Java 11 |
TESTS |
22 |
186 |
0 |
|
|
121677755 |
niting112 |
B |
July 8, 2021, 3:39 a.m. |
OK |
Java 11 |
TESTS |
22 |
233 |
0 |
|
|
121666662 |
quriouscreature |
B |
July 7, 2021, 10:28 p.m. |
OK |
Java 11 |
TESTS |
22 |
233 |
0 |
|
|
121680162 |
RuthlessAggression |
B |
July 8, 2021, 4:22 a.m. |
OK |
Java 11 |
TESTS |
22 |
233 |
4403200 |
|
|
121679980 |
jerry02 |
B |
July 8, 2021, 4:19 a.m. |
OK |
Java 11 |
TESTS |
22 |
248 |
0 |
|
|
121680863 |
RahulJangir |
B |
July 8, 2021, 4:34 a.m. |
OK |
Java 11 |
TESTS |
22 |
265 |
0 |
|
|
121683565 |
priyankb278 |
B |
July 8, 2021, 5:13 a.m. |
OK |
Java 11 |
TESTS |
22 |
280 |
0 |
|
|
121678800 |
jainpriyanshu341 |
B |
July 8, 2021, 3:58 a.m. |
OK |
Java 11 |
TESTS |
22 |
280 |
0 |
|
|
121679223 |
kakashi19 |
B |
July 8, 2021, 4:05 a.m. |
OK |
Java 11 |
TESTS |
22 |
280 |
17203200 |
|
|
121655848 |
_merlin_ |
B |
July 7, 2021, 6:44 p.m. |
OK |
Java 11 |
TESTS |
22 |
280 |
17305600 |
|
|
121679388 |
rakshith572 |
B |
July 8, 2021, 4:08 a.m. |
OK |
Java 8 |
TESTS |
22 |
155 |
2867200 |
|
|
121685717 |
gagan_6730 |
B |
July 8, 2021, 5:40 a.m. |
OK |
Java 8 |
TESTS |
22 |
156 |
2969600 |
|
|
121660834 |
coolManit |
B |
July 7, 2021, 7:55 p.m. |
OK |
Java 8 |
TESTS |
22 |
171 |
2764800 |
|
|
121669092 |
amit_roy |
B |
July 8, 2021, 12:14 a.m. |
OK |
Java 8 |
TESTS |
22 |
171 |
2969600 |
|
|
121662024 |
_Eyepatch |
B |
July 7, 2021, 8:18 p.m. |
OK |
Java 8 |
TESTS |
22 |
171 |
3481600 |
|
|
121660810 |
nikunj_22_nik |
B |
July 7, 2021, 7:55 p.m. |
OK |
Java 8 |
TESTS |
22 |
186 |
2764800 |
|
|
121641342 |
CHKIM |
B |
July 7, 2021, 4:33 p.m. |
OK |
Java 8 |
TESTS |
22 |
202 |
2867200 |
|
|
121672931 |
sidharth23 |
B |
July 8, 2021, 2:06 a.m. |
OK |
Java 8 |
TESTS |
22 |
202 |
17715200 |
|
|
121685487 |
manan_0104 |
B |
July 8, 2021, 5:37 a.m. |
OK |
Java 8 |
TESTS |
22 |
202 |
17817600 |
|
|
121672778 |
sidharth23 |
B |
July 8, 2021, 2:02 a.m. |
OK |
Java 8 |
TESTS |
22 |
218 |
17817600 |
|
|
121676664 |
Spheniscine |
B |
July 8, 2021, 3:20 a.m. |
OK |
Kotlin |
TESTS |
22 |
186 |
0 |
|
|
121667461 |
SlavaG |
B |
July 7, 2021, 11 p.m. |
OK |
Kotlin |
TESTS |
22 |
217 |
7680000 |
|
|
121664444 |
dandoh |
B |
July 7, 2021, 9:13 p.m. |
OK |
Kotlin |
TESTS |
22 |
265 |
16998400 |
|
|
121644063 |
markymarkmark |
B |
July 7, 2021, 4:40 p.m. |
OK |
Kotlin |
TESTS |
22 |
498 |
28057600 |
|
|
121685481 |
Kartik_V_Divate |
B |
July 8, 2021, 5:37 a.m. |
OK |
MS C++ |
TESTS |
22 |
202 |
0 |
|
|
121669767 |
RibbonDragon |
B |
July 8, 2021, 12:41 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
62 |
0 |
|
|
121674804 |
diajutcum |
B |
July 8, 2021, 2:46 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
93 |
0 |
|
|
121674331 |
jrhmq |
B |
July 8, 2021, 2:37 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
93 |
0 |
|
|
121672478 |
Pantong |
B |
July 8, 2021, 1:55 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
93 |
819200 |
|
|
121671711 |
MrLuoTrue |
B |
July 8, 2021, 1:37 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
93 |
819200 |
|
|
121641701 |
Refrain_c |
B |
July 7, 2021, 4:34 p.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
93 |
1638400 |
|
|
121672324 |
swz |
B |
July 8, 2021, 1:51 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
202 |
1638400 |
|
|
121665888 |
simpissa |
B |
July 7, 2021, 9:59 p.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
218 |
0 |
|
|
121659971 |
TheSherlockHomie |
B |
July 7, 2021, 7:39 p.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
218 |
0 |
|
|
121671028 |
inferno_ |
B |
July 8, 2021, 1:20 a.m. |
OK |
MS C++ 2017 |
TESTS |
22 |
233 |
0 |
|
|
121659648 |
ACoder_25 |
B |
July 7, 2021, 7:33 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
202 |
16076800 |
|
|
121652285 |
not_tehlka |
B |
July 7, 2021, 6:17 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
202 |
18534400 |
|
|
121656511 |
abhishekk_7 |
B |
July 7, 2021, 6:51 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
295 |
16486400 |
|
|
121667493 |
light_yagami52 |
B |
July 7, 2021, 11:02 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
311 |
18739200 |
|
|
121682222 |
caow |
B |
July 8, 2021, 4:55 a.m. |
OK |
PyPy 3 |
TESTS |
22 |
311 |
21708800 |
|
|
121653717 |
silvertint |
B |
July 7, 2021, 6:26 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
326 |
17203200 |
|
|
121658620 |
_aadiupadhyay_ |
B |
July 7, 2021, 7:17 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
327 |
17817600 |
|
|
121682270 |
majay1638 |
B |
July 8, 2021, 4:55 a.m. |
OK |
PyPy 3 |
TESTS |
22 |
327 |
18329600 |
|
|
121685518 |
Paritd |
B |
July 8, 2021, 5:37 a.m. |
OK |
PyPy 3 |
TESTS |
22 |
389 |
18329600 |
|
|
121659236 |
VarAmu |
B |
July 7, 2021, 7:26 p.m. |
OK |
PyPy 3 |
TESTS |
22 |
405 |
13824000 |
|
|
121671878 |
puffc0rn |
B |
July 8, 2021, 1:41 a.m. |
OK |
Python 3 |
TESTS |
22 |
124 |
16793600 |
|
|
121684891 |
jainil4801 |
B |
July 8, 2021, 5:30 a.m. |
OK |
Python 3 |
TESTS |
22 |
139 |
16691200 |
|
|
121675391 |
ritesh_43 |
B |
July 8, 2021, 2:57 a.m. |
OK |
Python 3 |
TESTS |
22 |
155 |
13721600 |
|
|
121676333 |
arvind.iyer.2001 |
B |
July 8, 2021, 3:14 a.m. |
OK |
Python 3 |
TESTS |
22 |
155 |
15667200 |
|
|
121674524 |
souvik03 |
B |
July 8, 2021, 2:41 a.m. |
OK |
Python 3 |
TESTS |
22 |
155 |
15769600 |
|
|
121652280 |
dk_04 |
B |
July 7, 2021, 6:17 p.m. |
OK |
Python 3 |
TESTS |
22 |
155 |
16076800 |
|
|
121673028 |
jeongdongha |
B |
July 8, 2021, 2:08 a.m. |
OK |
Python 3 |
TESTS |
22 |
155 |
16384000 |
|
|
121675520 |
purvababhulkar |
B |
July 8, 2021, 3 a.m. |
OK |
Python 3 |
TESTS |
22 |
156 |
15769600 |
|
|
121666700 |
tayyrov |
B |
July 7, 2021, 10:30 p.m. |
OK |
Python 3 |
TESTS |
22 |
156 |
15769600 |
|
|
121666605 |
mrwiredancer |
B |
July 7, 2021, 10:26 p.m. |
OK |
Python 3 |
TESTS |
22 |
156 |
15769600 |
|
|
121656801 |
IvanDyachenko |
B |
July 7, 2021, 6:54 p.m. |
OK |
Scala |
TESTS |
22 |
873 |
18636800 |
|
|
remove filters
Back to search problems