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"Daniel is watching a football team playing a game during their training session. They want to improve their passing skills during that session. The game involves n players, making multiple passes towards each other. Unfortunately, since the balls were moving too fast, after the session Daniel is unable to know how many balls were involved during the game. The only thing he knows is the number of passes delivered by each player during all the session. Find the minimum possible amount of balls that were involved in the game. There are several test cases in the input data. The first line contains a single integer t ( 1 <= q t <= q 5 cdot 10^4 ) -- the number of test cases. This is followed by the test cases description. The first line of each test case contains one integer n ( 2 <= q n <= q 10^5 ) -- the number of players. The second line of the test case contains a sequence of integers a_1, a_2, ldots, a_n ( 0 <= q a_i <= q 10^9 ), where a_i is the number of passes delivered by the i -th player. It is guaranteed that the sum of n over all test cases doesn't exceed 10^5 . For each test case print a single integer -- the answer to the problem. In the first test case, with the only ball, the game can go like this: 2 rightarrow 1 rightarrow 3 rightarrow 4 rightarrow 1 rightarrow 2 rightarrow 3 rightarrow 4 rightarrow 2 rightarrow 3 rightarrow 2 . In the second test case, there is no possible way to play the game with only one ball. One possible way to play with two balls: 2 rightarrow 1 rightarrow 2 rightarrow 3 rightarrow 2 rightarrow 1 . 2 rightarrow 3 rightarrow 2 rightarrow 1 In the third example, there were no passes, so 0 balls are possible. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
148639586 |
MallaSailesh |
B |
March 6, 2022, 7:11 p.m. |
OK |
GNU C11 |
TESTS |
14 |
217 |
409600 |
|
|
148615614 |
rainboy |
B |
March 6, 2022, 2:15 p.m. |
OK |
GNU C11 |
TESTS |
14 |
218 |
0 |
|
|
148597839 |
chhotelalk |
B |
March 6, 2022, 11:58 a.m. |
OK |
GNU C11 |
TESTS |
14 |
234 |
819200 |
|
|
148608181 |
_jhq |
B |
March 6, 2022, 1:14 p.m. |
OK |
GNU C++14 |
TESTS |
14 |
15 |
2560000 |
|
|
148602045 |
win10 |
B |
March 6, 2022, 12:09 p.m. |
OK |
GNU C++14 |
TESTS |
14 |
15 |
2867200 |
|
|
148654933 |
liang_cheng |
B |
March 7, 2022, 2:16 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
15 |
4608000 |
|
|
148655704 |
FrancaisDrake |
B |
March 7, 2022, 2:40 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
15 |
4608000 |
|
|
148611038 |
Afterglow. |
B |
March 6, 2022, 1:35 p.m. |
OK |
GNU C++14 |
TESTS |
14 |
15 |
19148800 |
|
|
148662432 |
Sadi_Hurayv |
B |
March 7, 2022, 5:16 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
30 |
409600 |
|
|
148607944 |
yyllqq |
B |
March 6, 2022, 1:12 p.m. |
OK |
GNU C++14 |
TESTS |
14 |
31 |
0 |
|
|
148661028 |
yiwu |
B |
March 7, 2022, 4:49 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
31 |
0 |
|
|
148618768 |
sunlightsingh |
B |
March 6, 2022, 2:46 p.m. |
OK |
GNU C++14 |
TESTS |
14 |
31 |
409600 |
|
|
148662410 |
Fantasyli |
B |
March 7, 2022, 5:16 a.m. |
OK |
GNU C++14 |
TESTS |
14 |
31 |
409600 |
|
|
148600652 |
yangzhanyu |
B |
March 6, 2022, 12:06 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
15 |
26112000 |
|
|
148621029 |
nnAyAnk |
B |
March 6, 2022, 3:10 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
30 |
409600 |
|
|
148643355 |
nahin_narcissus |
B |
March 6, 2022, 8:12 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
30 |
819200 |
|
|
148619495 |
arul.ashri |
B |
March 6, 2022, 2:54 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
30 |
819200 |
|
|
148617943 |
s1ngle_sir |
B |
March 6, 2022, 2:38 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
30 |
819200 |
|
|
148646083 |
AndreyC |
B |
March 6, 2022, 9:09 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
31 |
0 |
|
|
148645912 |
Bervig |
B |
March 6, 2022, 9:05 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
31 |
0 |
|
|
148662003 |
hritik31 |
B |
March 7, 2022, 5:08 a.m. |
OK |
GNU C++17 |
TESTS |
14 |
31 |
0 |
|
|
148652219 |
HX123 |
B |
March 7, 2022, 12:44 a.m. |
OK |
GNU C++17 |
TESTS |
14 |
31 |
0 |
|
|
148650383 |
wlsgud514 |
B |
March 6, 2022, 11:27 p.m. |
OK |
GNU C++17 |
TESTS |
14 |
31 |
0 |
|
|
148640414 |
CODEGod1 |
B |
March 6, 2022, 7:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
15 |
0 |
|
|
148623274 |
beedle |
B |
March 6, 2022, 3:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
15 |
819200 |
|
|
148639747 |
Manhar_Bhardwaj |
B |
March 6, 2022, 7:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
15 |
819200 |
|
|
148640430 |
spartanes |
B |
March 6, 2022, 7:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
15 |
819200 |
|
|
148606109 |
thusloop |
B |
March 6, 2022, 1:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
30 |
0 |
|
|
148645888 |
manzano |
B |
March 6, 2022, 9:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
30 |
0 |
|
|
148615474 |
NuclearWinter |
B |
March 6, 2022, 2:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
30 |
409600 |
|
|
148632248 |
evbu |
B |
March 6, 2022, 5:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
30 |
409600 |
|
|
148645132 |
NotKushagra |
B |
March 6, 2022, 8:47 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
30 |
409600 |
|
|
148644017 |
ruadhan |
B |
March 6, 2022, 8:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
14 |
30 |
819200 |
|
|
148635625 |
Shahed_955 |
B |
March 6, 2022, 6:14 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148629372 |
MiaomiaoZi |
B |
March 6, 2022, 4:51 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148619194 |
Mr_Ell |
B |
March 6, 2022, 2:51 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148618415 |
Tuanliz0403 |
B |
March 6, 2022, 2:42 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148614526 |
dqk |
B |
March 6, 2022, 2:05 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148607584 |
End_the_rew |
B |
March 6, 2022, 1:10 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148606046 |
recursiveWarrior |
B |
March 6, 2022, 1 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148664759 |
rsbayzed |
B |
March 7, 2022, 5:55 a.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148658995 |
decoder_aniket |
B |
March 7, 2022, 4:02 a.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148646738 |
SILA_edr |
B |
March 6, 2022, 9:24 p.m. |
OK |
GNU C++20 (64) |
TESTS |
14 |
15 |
0 |
|
|
148650898 |
Longgggggggg |
B |
March 6, 2022, 11:48 p.m. |
OK |
Java 11 |
TESTS |
14 |
171 |
0 |
|
|
148626863 |
LNB |
B |
March 6, 2022, 4:19 p.m. |
OK |
Java 11 |
TESTS |
14 |
171 |
0 |
|
|
148626961 |
Satyaa |
B |
March 6, 2022, 4:20 p.m. |
OK |
Java 11 |
TESTS |
14 |
186 |
0 |
|
|
148627675 |
nbhakar |
B |
March 6, 2022, 4:29 p.m. |
OK |
Java 11 |
TESTS |
14 |
187 |
0 |
|
|
148618653 |
eshan18.09 |
B |
March 6, 2022, 2:45 p.m. |
OK |
Java 11 |
TESTS |
14 |
202 |
0 |
|
|
148617336 |
SaberXpro |
B |
March 6, 2022, 2:32 p.m. |
OK |
Java 11 |
TESTS |
14 |
202 |
0 |
|
|
148664653 |
__Serendipity |
B |
March 7, 2022, 5:53 a.m. |
OK |
Java 11 |
TESTS |
14 |
217 |
0 |
|
|
148610832 |
learnjava |
B |
March 6, 2022, 1:34 p.m. |
OK |
Java 11 |
TESTS |
14 |
218 |
0 |
|
|
148617292 |
SaberXpro |
B |
March 6, 2022, 2:32 p.m. |
OK |
Java 11 |
TESTS |
14 |
218 |
0 |
|
|
148605830 |
Restricted |
B |
March 6, 2022, 12:59 p.m. |
OK |
Java 11 |
TESTS |
14 |
218 |
0 |
|
|
148630134 |
Diaa12360 |
B |
March 6, 2022, 5:01 p.m. |
OK |
Java 8 |
TESTS |
14 |
109 |
0 |
|
|
148606281 |
ak_ankit |
B |
March 6, 2022, 1:01 p.m. |
OK |
Java 8 |
TESTS |
14 |
109 |
0 |
|
|
148646131 |
ruchir28 |
B |
March 6, 2022, 9:11 p.m. |
OK |
Java 8 |
TESTS |
14 |
124 |
0 |
|
|
148636198 |
aryaman_571 |
B |
March 6, 2022, 6:22 p.m. |
OK |
Java 8 |
TESTS |
14 |
124 |
0 |
|
|
148633328 |
tarun_sm |
B |
March 6, 2022, 5:44 p.m. |
OK |
Java 8 |
TESTS |
14 |
124 |
0 |
|
|
148664458 |
aries.pratyush |
B |
March 7, 2022, 5:50 a.m. |
OK |
Java 8 |
TESTS |
14 |
139 |
0 |
|
|
148658495 |
gssakash |
B |
March 7, 2022, 3:51 a.m. |
OK |
Java 8 |
TESTS |
14 |
139 |
0 |
|
|
148627885 |
RonWonWon |
B |
March 6, 2022, 4:31 p.m. |
OK |
Java 8 |
TESTS |
14 |
139 |
0 |
|
|
148598079 |
priyaroy3370 |
B |
March 6, 2022, 11:59 a.m. |
OK |
Java 8 |
TESTS |
14 |
139 |
921600 |
|
|
148619969 |
ne1tron |
B |
March 6, 2022, 2:59 p.m. |
OK |
Java 8 |
TESTS |
14 |
389 |
0 |
|
|
148655785 |
TOURR |
B |
March 7, 2022, 2:42 a.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
264 |
0 |
|
|
148625463 |
DarkSun |
B |
March 6, 2022, 4:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
280 |
819200 |
|
|
148615444 |
MR_QINY |
B |
March 6, 2022, 2:14 p.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
280 |
819200 |
|
|
148647030 |
Viktor36 |
B |
March 6, 2022, 9:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
296 |
0 |
|
|
148624666 |
hnust_wunengwu |
B |
March 6, 2022, 3:53 p.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
296 |
409600 |
|
|
148597018 |
Score12122 |
B |
March 6, 2022, 11:56 a.m. |
OK |
MS C++ 2017 |
TESTS |
14 |
311 |
409600 |
|
|
148625343 |
1_2_3_4_5_9 |
B |
March 6, 2022, 4:01 p.m. |
OK |
PyPy 2 |
TESTS |
14 |
186 |
5427200 |
|
|
148608124 |
lemiao12 |
B |
March 6, 2022, 1:13 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
155 |
6451200 |
|
|
148611934 |
shobonvip |
B |
March 6, 2022, 1:43 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
171 |
5734400 |
|
|
148614383 |
legend.ary_as |
B |
March 6, 2022, 2:04 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
171 |
7884800 |
|
|
148656834 |
puffc0rn |
B |
March 7, 2022, 3:09 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
202 |
72499200 |
|
|
148595270 |
AAIIUU |
B |
March 6, 2022, 11:50 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
233 |
9113600 |
|
|
148653599 |
rutz12 |
B |
March 7, 2022, 1:32 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
233 |
9216000 |
|
|
148607730 |
ambs_ |
B |
March 6, 2022, 1:11 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
233 |
9625600 |
|
|
148637402 |
Ahmed_Turkman |
B |
March 6, 2022, 6:38 p.m. |
OK |
PyPy 3 |
TESTS |
14 |
249 |
9523200 |
|
|
148660957 |
BareAttention98 |
B |
March 7, 2022, 4:47 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
264 |
9420800 |
|
|
148658128 |
Virender |
B |
March 7, 2022, 3:41 a.m. |
OK |
PyPy 3 |
TESTS |
14 |
280 |
9625600 |
|
|
148660639 |
notTehlka |
B |
March 7, 2022, 4:41 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
124 |
13721600 |
|
|
148606750 |
sigilius |
B |
March 6, 2022, 1:04 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
124 |
14438400 |
|
|
148634166 |
bpdolson |
B |
March 6, 2022, 5:54 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
139 |
14848000 |
|
|
148620006 |
beethoven97 |
B |
March 6, 2022, 2:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
140 |
9728000 |
|
|
148615167 |
sakshatmali |
B |
March 6, 2022, 2:11 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
140 |
9932800 |
|
|
148629142 |
nitish420 |
B |
March 6, 2022, 4:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
140 |
13721600 |
|
|
148619763 |
ossau_guildo |
B |
March 6, 2022, 2:57 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
140 |
13824000 |
|
|
148623142 |
KanishkGoel |
B |
March 6, 2022, 3:35 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
155 |
14336000 |
|
|
148633982 |
a_vantik_a |
B |
March 6, 2022, 5:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
171 |
9625600 |
|
|
148630537 |
thevaibhavdixit |
B |
March 6, 2022, 5:06 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
171 |
14950400 |
|
|
148644145 |
OLOGY |
B |
March 6, 2022, 8:27 p.m. |
OK |
Python 2 |
TESTS |
14 |
171 |
3584000 |
|
|
148643839 |
OLOGY |
B |
March 6, 2022, 8:21 p.m. |
OK |
Python 2 |
TESTS |
14 |
171 |
3584000 |
|
|
148627411 |
narrennagendra |
B |
March 6, 2022, 4:26 p.m. |
OK |
Python 3 |
TESTS |
14 |
202 |
1536000 |
|
|
148609990 |
dvaravind |
B |
March 6, 2022, 1:27 p.m. |
OK |
Python 3 |
TESTS |
14 |
218 |
2150400 |
|
|
148631866 |
Bshhhh |
B |
March 6, 2022, 5:25 p.m. |
OK |
Python 3 |
TESTS |
14 |
234 |
4198400 |
|
|
148631599 |
dalbaeb69 |
B |
March 6, 2022, 5:21 p.m. |
OK |
Python 3 |
TESTS |
14 |
234 |
4198400 |
|
|
148608249 |
yiming1012 |
B |
March 6, 2022, 1:14 p.m. |
OK |
Python 3 |
TESTS |
14 |
234 |
4198400 |
|
|
148643135 |
abineth |
B |
March 6, 2022, 8:07 p.m. |
OK |
Python 3 |
TESTS |
14 |
249 |
1536000 |
|
|
148639128 |
s4ge |
B |
March 6, 2022, 7:04 p.m. |
OK |
Python 3 |
TESTS |
14 |
514 |
1331200 |
|
|
148611658 |
VictorMMorant |
B |
March 6, 2022, 1:40 p.m. |
OK |
Python 3 |
TESTS |
14 |
529 |
1126400 |
|
|
148622611 |
zxcuser1 |
B |
March 6, 2022, 3:29 p.m. |
OK |
Python 3 |
TESTS |
14 |
529 |
1331200 |
|
|
148615445 |
Skillful_Wanderer |
B |
March 6, 2022, 2:14 p.m. |
OK |
Python 3 |
TESTS |
14 |
530 |
1331200 |
|
|
148604941 |
RustyInCP |
B |
March 6, 2022, 12:55 p.m. |
OK |
Rust 2021 |
TESTS |
14 |
15 |
819200 |
|
|
remove filters
Back to search problems