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 |
1637
|
Codeforces Global Round 19 |
FINISHED |
False |
9000 |
87146699 |
Feb. 12, 2022, 2:35 p.m. |
Problems
B"Andrew has n piles with stones. The i -th pile contains a_i stones. He wants to make his table clean so he decided to put every stone either to the 1 -st or the n -th pile. Andrew can perform the following operation any number of times: choose 3 indices 1 <= i < j < k <= n , such that the j -th pile contains at least 2 stones, then he takes 2 stones from the pile j and puts one stone into pile i and one stone into pile k . Tell Andrew what is the minimum number of operations needed to move all the stones to piles 1 and n , or determine if it's impossible. The input contains several test cases. The first line contains one integer t ( 1 <= q t <= q 10 ,000 ) -- the number of test cases. The first line for each test case contains one integer n ( 3 <= q n <= q 10^5 ) -- the length of the array. The second line contains a sequence of integers a_1, a_2, ldots, a_n ( 1 <= q a_i <= q 10^9 ) -- the array elements. It is guaranteed that the sum of the values n over all test cases does not exceed 10^5 . For each test case print the minimum number of operations needed to move stones to piles 1 and n , or print -1 if it's impossible. In the first test case, it is optimal to do the following: In the second test case, it's impossible to put all stones into piles with numbers 1 and 3 : In the third test case, it's optimal to do the following: In the fourth test case, it's impossible to do any operation, and the array doesn't satisfy the statement, so the answer is -1 . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
146168094 |
dean.menezes |
C |
Feb. 12, 2022, 7:41 p.m. |
OK |
GNU C11 |
TESTS |
23 |
62 |
0 |
|
|
146190803 |
hnust_linuo |
C |
Feb. 13, 2022, 4:04 a.m. |
OK |
GNU C11 |
TESTS |
23 |
62 |
0 |
|
|
146151322 |
Tonyzyx |
C |
Feb. 12, 2022, 4:59 p.m. |
OK |
GNU C11 |
TESTS |
23 |
62 |
409600 |
|
|
146167021 |
Ashish_Varma |
C |
Feb. 12, 2022, 7:28 p.m. |
OK |
GNU C11 |
TESTS |
23 |
62 |
819200 |
|
|
146192603 |
MallaSailesh |
C |
Feb. 13, 2022, 4:36 a.m. |
OK |
GNU C11 |
TESTS |
23 |
77 |
409600 |
|
|
146187330 |
hljnb |
C |
Feb. 13, 2022, 2:54 a.m. |
OK |
GNU C11 |
TESTS |
23 |
77 |
409600 |
|
|
146184182 |
ofcoursenotsh |
C |
Feb. 13, 2022, 1:36 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
15 |
1126400 |
|
|
146149322 |
Zuka |
C |
Feb. 12, 2022, 4:54 p.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
0 |
|
|
146187794 |
Gongyiming |
C |
Feb. 13, 2022, 3:05 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
0 |
|
|
146192242 |
Dream4U |
C |
Feb. 13, 2022, 4:30 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
409600 |
|
|
146191481 |
Morpheus2006 |
C |
Feb. 13, 2022, 4:17 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
409600 |
|
|
146195938 |
Lskkkno3 |
C |
Feb. 13, 2022, 5:25 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
409600 |
|
|
146194808 |
freakin23 |
C |
Feb. 13, 2022, 5:09 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
409600 |
|
|
146193046 |
impostor_ |
C |
Feb. 13, 2022, 4:43 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
409600 |
|
|
146197025 |
_bverma512 |
C |
Feb. 13, 2022, 5:39 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
409600 |
|
|
146196732 |
akashpal130771 |
C |
Feb. 13, 2022, 5:35 a.m. |
OK |
GNU C++14 |
TESTS |
23 |
31 |
409600 |
|
|
146158902 |
Sajjat004 |
C |
Feb. 12, 2022, 6:09 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
0 |
|
|
146163564 |
Abo4ams |
C |
Feb. 12, 2022, 6:48 p.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
0 |
|
|
146184171 |
A_mere_coder |
C |
Feb. 13, 2022, 1:35 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
0 |
|
|
146181999 |
mostafa_ayman |
C |
Feb. 13, 2022, 12:35 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
102400 |
|
|
146197288 |
TkFox_wa |
C |
Feb. 13, 2022, 5:41 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
409600 |
|
|
146198818 |
Cloud_ |
C |
Feb. 13, 2022, 5:59 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
409600 |
|
|
146198666 |
Ssaranshh13 |
C |
Feb. 13, 2022, 5:58 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
409600 |
|
|
146197988 |
rbl_p |
C |
Feb. 13, 2022, 5:50 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
409600 |
|
|
146197657 |
Its_AJ |
C |
Feb. 13, 2022, 5:46 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
409600 |
|
|
146198890 |
rajatupadhyay9 |
C |
Feb. 13, 2022, 6 a.m. |
OK |
GNU C++17 |
TESTS |
23 |
31 |
409600 |
|
|
146151473 |
Mission-Red |
C |
Feb. 12, 2022, 4:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
0 |
|
|
146167905 |
AnDrewHAliEm |
C |
Feb. 12, 2022, 7:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146178003 |
rgnerdplayer |
C |
Feb. 12, 2022, 10:36 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146173568 |
cjoa |
C |
Feb. 12, 2022, 9:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146173136 |
Anish_28 |
C |
Feb. 12, 2022, 8:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146170567 |
_anujkirodia |
C |
Feb. 12, 2022, 8:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
819200 |
|
|
146165164 |
dufresne_1949 |
C |
Feb. 12, 2022, 7:06 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
819200 |
|
|
146158000 |
kitkat9 |
C |
Feb. 12, 2022, 6:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
819200 |
|
|
146186674 |
linxd |
C |
Feb. 13, 2022, 2:38 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
15 |
1638400 |
|
|
146195947 |
rav_ish |
C |
Feb. 13, 2022, 5:26 a.m. |
OK |
GNU C++17 (64) |
TESTS |
23 |
30 |
409600 |
|
|
146171612 |
Lextyle |
C |
Feb. 12, 2022, 8:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
0 |
|
|
146166750 |
illusionist27 |
C |
Feb. 12, 2022, 7:25 p.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
0 |
|
|
146181755 |
PkKz |
C |
Feb. 13, 2022, 12:28 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146181604 |
BhavyaBhatt |
C |
Feb. 13, 2022, 12:22 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146180948 |
Meul |
C |
Feb. 13, 2022, 12:04 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146182925 |
gxy001 |
C |
Feb. 13, 2022, 1:01 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146183739 |
giaminh2211 |
C |
Feb. 13, 2022, 1:24 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146187762 |
Mushfiq_Talha |
C |
Feb. 13, 2022, 3:04 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146194708 |
N_Crypted |
C |
Feb. 13, 2022, 5:08 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146197118 |
_ywl |
C |
Feb. 13, 2022, 5:40 a.m. |
OK |
GNU C++20 (64) |
TESTS |
23 |
15 |
409600 |
|
|
146158434 |
koqo |
C |
Feb. 12, 2022, 6:06 p.m. |
OK |
Go |
TESTS |
23 |
108 |
2355200 |
|
|
146168030 |
vadimlog932 |
C |
Feb. 12, 2022, 7:40 p.m. |
OK |
Go |
TESTS |
23 |
140 |
1638400 |
|
|
146163765 |
Satyaa |
C |
Feb. 12, 2022, 6:50 p.m. |
OK |
Java 11 |
TESTS |
23 |
171 |
0 |
|
|
146173825 |
S-A-I-T-A-M-A |
C |
Feb. 12, 2022, 9:07 p.m. |
OK |
Java 11 |
TESTS |
23 |
171 |
0 |
|
|
146169790 |
Long214 |
C |
Feb. 12, 2022, 8:03 p.m. |
OK |
Java 11 |
TESTS |
23 |
171 |
0 |
|
|
146172670 |
henrychenOutlook |
C |
Feb. 12, 2022, 8:48 p.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
0 |
|
|
146198080 |
_ryan18_ |
C |
Feb. 13, 2022, 5:51 a.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
0 |
|
|
146181846 |
Sandy_coder2001 |
C |
Feb. 13, 2022, 12:30 a.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
0 |
|
|
146180729 |
Toinfinity |
C |
Feb. 12, 2022, 11:58 p.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
0 |
|
|
146167923 |
mareshkau |
C |
Feb. 12, 2022, 7:39 p.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
0 |
|
|
146147341 |
niketan |
C |
Feb. 12, 2022, 4:49 p.m. |
OK |
Java 11 |
TESTS |
23 |
187 |
0 |
|
|
146193567 |
iamsoumik |
C |
Feb. 13, 2022, 4:51 a.m. |
OK |
Java 11 |
TESTS |
23 |
202 |
0 |
|
|
146174514 |
getxy |
C |
Feb. 12, 2022, 9:20 p.m. |
OK |
Java 8 |
TESTS |
23 |
93 |
0 |
|
|
146170974 |
DEMO23 |
C |
Feb. 12, 2022, 8:21 p.m. |
OK |
Java 8 |
TESTS |
23 |
109 |
0 |
|
|
146163140 |
Sjoa |
C |
Feb. 12, 2022, 6:44 p.m. |
OK |
Java 8 |
TESTS |
23 |
109 |
1843200 |
|
|
146158183 |
sky9313 |
C |
Feb. 12, 2022, 6:05 p.m. |
OK |
Java 8 |
TESTS |
23 |
109 |
1945600 |
|
|
146169085 |
harshitnsharma |
C |
Feb. 12, 2022, 7:54 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
0 |
|
|
146149677 |
g906360 |
C |
Feb. 12, 2022, 4:55 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
1843200 |
|
|
146164890 |
ved20 |
C |
Feb. 12, 2022, 7:02 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
1843200 |
|
|
146160934 |
khwrzm |
C |
Feb. 12, 2022, 6:24 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
1843200 |
|
|
146179762 |
dev_14 |
C |
Feb. 12, 2022, 11:27 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
1945600 |
|
|
146152669 |
Aabhas99 |
C |
Feb. 12, 2022, 5:02 p.m. |
OK |
Java 8 |
TESTS |
23 |
124 |
7475200 |
|
|
146184021 |
mo3az01 |
C |
Feb. 13, 2022, 1:31 a.m. |
OK |
Kotlin 1.5 |
TESTS |
23 |
405 |
13824000 |
|
|
146166915 |
Sea_hawk |
C |
Feb. 12, 2022, 7:27 p.m. |
OK |
Mono C# |
TESTS |
23 |
124 |
16281600 |
|
|
146165698 |
psn2706 |
C |
Feb. 12, 2022, 7:12 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
93 |
921600 |
|
|
146163288 |
AhmadAlsous |
C |
Feb. 12, 2022, 6:45 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
124 |
0 |
|
|
146185542 |
SinaLIze |
C |
Feb. 13, 2022, 2:11 a.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
139 |
409600 |
|
|
146148057 |
Samon27 |
C |
Feb. 12, 2022, 4:51 p.m. |
OK |
MS C++ 2017 |
TESTS |
23 |
139 |
819200 |
|
|
146193370 |
Tdyx |
C |
Feb. 13, 2022, 4:48 a.m. |
OK |
.NET Core C# |
TESTS |
23 |
156 |
9318400 |
|
|
146193299 |
Orazgeldi |
C |
Feb. 13, 2022, 4:47 a.m. |
OK |
PascalABC.NET |
TESTS |
23 |
530 |
102400 |
|
|
146157461 |
1_2_3_4_5_9 |
C |
Feb. 12, 2022, 6:02 p.m. |
OK |
PyPy 2 |
TESTS |
23 |
186 |
8908800 |
|
|
146153150 |
feelme |
C |
Feb. 12, 2022, 5:03 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
140 |
10137600 |
|
|
146198244 |
Nipun_Jugran |
C |
Feb. 13, 2022, 5:53 a.m. |
OK |
PyPy 3 |
TESTS |
23 |
202 |
11059200 |
|
|
146181942 |
FlakeLCR |
C |
Feb. 13, 2022, 12:33 a.m. |
OK |
PyPy 3 |
TESTS |
23 |
217 |
10854400 |
|
|
146170816 |
vstatarenko |
C |
Feb. 12, 2022, 8:19 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
233 |
11161600 |
|
|
146160000 |
Ahmed_Turkman |
C |
Feb. 12, 2022, 6:16 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
248 |
11059200 |
|
|
146158185 |
hwei002 |
C |
Feb. 12, 2022, 6:05 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
249 |
11161600 |
|
|
146172175 |
vrajh |
C |
Feb. 12, 2022, 8:40 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
249 |
13721600 |
|
|
146173981 |
toam |
C |
Feb. 12, 2022, 9:10 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
280 |
11366400 |
|
|
146181725 |
majay1638 |
C |
Feb. 13, 2022, 12:27 a.m. |
OK |
PyPy 3 |
TESTS |
23 |
295 |
10752000 |
|
|
146162101 |
sangram03 |
C |
Feb. 12, 2022, 6:35 p.m. |
OK |
PyPy 3 |
TESTS |
23 |
295 |
14028800 |
|
|
146194476 |
viraldoshi |
C |
Feb. 13, 2022, 5:05 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
155 |
14438400 |
|
|
146164943 |
mayank35 |
C |
Feb. 12, 2022, 7:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
171 |
12902400 |
|
|
146171674 |
kaustavshouvik |
C |
Feb. 12, 2022, 8:31 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
187 |
13209600 |
|
|
146175246 |
alxwen711 |
C |
Feb. 12, 2022, 9:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
217 |
16281600 |
|
|
146189012 |
cofonewbie |
C |
Feb. 13, 2022, 3:31 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
233 |
15462400 |
|
|
146182899 |
titan23 |
C |
Feb. 13, 2022, 1 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
248 |
15462400 |
|
|
146160313 |
Soumik43 |
C |
Feb. 12, 2022, 6:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
248 |
16691200 |
|
|
146182644 |
titan23 |
C |
Feb. 13, 2022, 12:53 a.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
249 |
17305600 |
|
|
146161382 |
IkshitG |
C |
Feb. 12, 2022, 6:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
249 |
19456000 |
|
|
146153022 |
sohamb17 |
C |
Feb. 12, 2022, 5:03 p.m. |
OK |
PyPy 3-64 |
TESTS |
23 |
265 |
19660800 |
|
|
146181223 |
OLOGY |
C |
Feb. 13, 2022, 12:11 a.m. |
OK |
Python 2 |
TESTS |
23 |
109 |
6758400 |
|
|
146172035 |
Tasia2001 |
C |
Feb. 12, 2022, 8:38 p.m. |
OK |
Python 3 |
TESTS |
23 |
170 |
8806400 |
|
|
146152624 |
stop_using_cp_for_jobs |
C |
Feb. 12, 2022, 5:02 p.m. |
OK |
Python 3 |
TESTS |
23 |
171 |
8806400 |
|
|
146198221 |
G_R_L |
C |
Feb. 13, 2022, 5:53 a.m. |
OK |
Python 3 |
TESTS |
23 |
186 |
8806400 |
|
|
146198200 |
Brunhilo_wul |
C |
Feb. 13, 2022, 5:52 a.m. |
OK |
Python 3 |
TESTS |
23 |
186 |
8806400 |
|
|
146195859 |
choko100 |
C |
Feb. 13, 2022, 5:24 a.m. |
OK |
Python 3 |
TESTS |
23 |
186 |
8806400 |
|
|
146190165 |
20020meb1331 |
C |
Feb. 13, 2022, 3:53 a.m. |
OK |
Python 3 |
TESTS |
23 |
186 |
8806400 |
|
|
146165726 |
kamtendra_20 |
C |
Feb. 12, 2022, 7:13 p.m. |
OK |
Python 3 |
TESTS |
23 |
186 |
8806400 |
|
|
146149633 |
Yannan |
C |
Feb. 12, 2022, 4:55 p.m. |
OK |
Python 3 |
TESTS |
23 |
186 |
8806400 |
|
|
146157854 |
sahilm |
C |
Feb. 12, 2022, 6:03 p.m. |
OK |
Python 3 |
TESTS |
23 |
186 |
8806400 |
|
|
146180993 |
kaveti.shivanjali315 |
C |
Feb. 13, 2022, 12:05 a.m. |
OK |
Python 3 |
TESTS |
23 |
187 |
8806400 |
|
|
146183301 |
bqn |
C |
Feb. 13, 2022, 1:12 a.m. |
OK |
Rust 2021 |
TESTS |
23 |
93 |
4198400 |
|
|
146159396 |
zhhhplus |
C |
Feb. 12, 2022, 6:12 p.m. |
OK |
Rust 2021 |
TESTS |
23 |
93 |
8704000 |
|
|
146183877 |
bqn |
C |
Feb. 13, 2022, 1:27 a.m. |
OK |
Rust 2021 |
TESTS |
23 |
108 |
4198400 |
|
|
remove filters
Back to search problems