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'This is the easy version of the problem. The only difference is that in this version n <= q 2000 . You can make hacks only if both versions of the problem are solved. There are n potions in a line, with potion 1 on the far left and potion n on the far right. Each potion will increase your health by a_i when drunk. a_i can be negative, meaning that potion will decrease will health. You start with 0 health and you will walk from left to right, from first potion to the last one. At each potion, you may choose to drink it or ignore it. You must ensure that your health is always non-negative. What is the largest number of potions you can drink? The first line contains a single integer n ( 1 <= q n <= q 2000 ) -- the number of potions. The next line contains n integers a_1 , a_2 , ... , a_n ( -10^9 <= q a_i <= q 10^9 ) which represent the change in health after drinking that potion. Output a single integer, the maximum number of potions you can drink without your health becoming negative. For the sample, you can drink 5 potions by taking potions 1 , 3 , 4 , 5 and 6 . It is not possible to drink all 6 potions because your health will go negative at some point '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
117715505 |
RaDsZ2zz |
C1 |
May 29, 2021, 1:51 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117729961 |
Bad_liar |
C1 |
May 29, 2021, 5:40 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117728804 |
rsrkpatwari |
C1 |
May 29, 2021, 5:28 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117722997 |
xueyan |
C1 |
May 29, 2021, 4:14 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117722773 |
touristyyds |
C1 |
May 29, 2021, 4:11 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117720948 |
hiendeptrai05 |
C1 |
May 29, 2021, 3:40 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117719699 |
cwf123 |
C1 |
May 29, 2021, 3:18 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117719165 |
ybs1164 |
C1 |
May 29, 2021, 3:08 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117716766 |
NEFU_Smith |
C1 |
May 29, 2021, 2:19 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117716221 |
syyyl |
C1 |
May 29, 2021, 2:07 a.m. |
OK |
GNU C++11 |
TESTS |
19 |
15 |
0 |
|
|
117722707 |
ZED7X |
C1 |
May 29, 2021, 4:10 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117731020 |
hardy_9795 |
C1 |
May 29, 2021, 5:52 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117729502 |
blackHaMMer69 |
C1 |
May 29, 2021, 5:35 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117729195 |
sakibmalik |
C1 |
May 29, 2021, 5:33 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117727329 |
parth21 |
C1 |
May 29, 2021, 5:12 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117714974 |
SurajitPore |
C1 |
May 29, 2021, 1:38 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117711900 |
SF-Manman |
C1 |
May 29, 2021, 12:44 a.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117704512 |
Harsh0911 |
C1 |
May 28, 2021, 8:36 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117700958 |
priyanshu1011 |
C1 |
May 28, 2021, 7:36 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117697755 |
kulshr_0207 |
C1 |
May 28, 2021, 6:52 p.m. |
OK |
GNU C++14 |
TESTS |
19 |
15 |
0 |
|
|
117723577 |
100_IQ |
C1 |
May 29, 2021, 4:24 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117731722 |
Garguy07 |
C1 |
May 29, 2021, 6 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117730665 |
Sambasai |
C1 |
May 29, 2021, 5:49 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117729183 |
codingvampire |
C1 |
May 29, 2021, 5:32 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117727991 |
shuklaaditya |
C1 |
May 29, 2021, 5:19 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117727768 |
zonky |
C1 |
May 29, 2021, 5:17 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117727326 |
ps-19 |
C1 |
May 29, 2021, 5:12 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117727126 |
sarwar__ |
C1 |
May 29, 2021, 5:10 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117724402 |
codemaster108 |
C1 |
May 29, 2021, 4:36 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117723940 |
Last_whisper |
C1 |
May 29, 2021, 4:29 a.m. |
OK |
GNU C++17 |
TESTS |
19 |
15 |
0 |
|
|
117698527 |
Jagonmoy |
C1 |
May 28, 2021, 7:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117728225 |
Apotheosis |
C1 |
May 29, 2021, 5:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117725049 |
Misbaul_Hasan |
C1 |
May 29, 2021, 4:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117721085 |
akshaykhandelwal |
C1 |
May 29, 2021, 3:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117720340 |
AMO5 |
C1 |
May 29, 2021, 3:30 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117718313 |
Assem99 |
C1 |
May 29, 2021, 2:52 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117692325 |
Chivas_Regal |
C1 |
May 28, 2021, 5:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117713097 |
Murabito-B |
C1 |
May 29, 2021, 1:20 a.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117704577 |
DARK49 |
C1 |
May 28, 2021, 8:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117699555 |
shiv_17 |
C1 |
May 28, 2021, 7:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
19 |
15 |
0 |
|
|
117728758 |
yogii_123 |
C1 |
May 29, 2021, 5:28 a.m. |
OK |
Java 11 |
TESTS |
19 |
156 |
0 |
|
|
117721054 |
aayushdhakad |
C1 |
May 29, 2021, 3:42 a.m. |
OK |
Java 11 |
TESTS |
19 |
171 |
0 |
|
|
117728159 |
pikachu_pika_pika |
C1 |
May 29, 2021, 5:21 a.m. |
OK |
Java 11 |
TESTS |
19 |
171 |
0 |
|
|
117725809 |
ricky8233 |
C1 |
May 29, 2021, 4:54 a.m. |
OK |
Java 11 |
TESTS |
19 |
171 |
0 |
|
|
117724815 |
athakre1962000 |
C1 |
May 29, 2021, 4:41 a.m. |
OK |
Java 11 |
TESTS |
19 |
171 |
0 |
|
|
117709195 |
5612 |
C1 |
May 28, 2021, 10:47 p.m. |
OK |
Java 11 |
TESTS |
19 |
171 |
0 |
|
|
117707624 |
gourav02 |
C1 |
May 28, 2021, 9:52 p.m. |
OK |
Java 11 |
TESTS |
19 |
171 |
0 |
|
|
117704092 |
Kunal_30 |
C1 |
May 28, 2021, 8:28 p.m. |
OK |
Java 11 |
TESTS |
19 |
171 |
0 |
|
|
117727459 |
tushar_patil |
C1 |
May 29, 2021, 5:14 a.m. |
OK |
Java 11 |
TESTS |
19 |
186 |
0 |
|
|
117726379 |
arpit31 |
C1 |
May 29, 2021, 5:02 a.m. |
OK |
Java 11 |
TESTS |
19 |
186 |
0 |
|
|
117700588 |
Adi_7861 |
C1 |
May 28, 2021, 7:30 p.m. |
OK |
Java 8 |
TESTS |
19 |
108 |
0 |
|
|
117722265 |
InANutshell |
C1 |
May 29, 2021, 4:03 a.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117720270 |
NerfThis |
C1 |
May 29, 2021, 3:29 a.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117703016 |
mareshkau |
C1 |
May 28, 2021, 8:08 p.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117702004 |
coder_terror |
C1 |
May 28, 2021, 7:52 p.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117701180 |
Adi_7861 |
C1 |
May 28, 2021, 7:40 p.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117698876 |
pgthebigshot |
C1 |
May 28, 2021, 7:07 p.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117697829 |
tiwariabhishek |
C1 |
May 28, 2021, 6:53 p.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117726894 |
trappy00_28 |
C1 |
May 29, 2021, 5:07 a.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117725234 |
Dstoical |
C1 |
May 29, 2021, 4:47 a.m. |
OK |
Java 8 |
TESTS |
19 |
109 |
0 |
|
|
117695341 |
codersanjeev |
C1 |
May 28, 2021, 6:26 p.m. |
OK |
Kotlin |
TESTS |
19 |
140 |
0 |
|
|
117704630 |
JohnCode |
C1 |
May 28, 2021, 8:39 p.m. |
OK |
MS C++ 2017 |
TESTS |
19 |
15 |
102400 |
|
|
117731241 |
Bulysky |
C1 |
May 29, 2021, 5:55 a.m. |
OK |
MS C++ 2017 |
TESTS |
19 |
46 |
38809600 |
|
|
117715544 |
sakapon |
C1 |
May 29, 2021, 1:52 a.m. |
OK |
.NET Core C# |
TESTS |
19 |
374 |
35942400 |
|
|
117728728 |
henrychenOutlook |
C1 |
May 29, 2021, 5:27 a.m. |
OK |
Node.js |
TESTS |
19 |
77 |
1536000 |
|
|
117706033 |
lebron87 |
C1 |
May 28, 2021, 9:13 p.m. |
OK |
PyPy 2 |
TESTS |
19 |
186 |
9318400 |
|
|
117731290 |
mokhtar_madhfar |
C1 |
May 29, 2021, 5:56 a.m. |
OK |
PyPy 3 |
TESTS |
19 |
93 |
2048000 |
|
|
117717736 |
vishwaskalani2002 |
C1 |
May 29, 2021, 2:40 a.m. |
OK |
PyPy 3 |
TESTS |
19 |
93 |
2048000 |
|
|
117710359 |
hritik3878 |
C1 |
May 28, 2021, 11:45 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
108 |
2867200 |
|
|
117722775 |
Mohammad_Alam |
C1 |
May 29, 2021, 4:11 a.m. |
OK |
PyPy 3 |
TESTS |
19 |
109 |
2048000 |
|
|
117716725 |
Death_God333 |
C1 |
May 29, 2021, 2:18 a.m. |
OK |
PyPy 3 |
TESTS |
19 |
109 |
2048000 |
|
|
117716547 |
ritesh_43 |
C1 |
May 29, 2021, 2:14 a.m. |
OK |
PyPy 3 |
TESTS |
19 |
109 |
2048000 |
|
|
117699941 |
coder_11 |
C1 |
May 28, 2021, 7:21 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
109 |
2150400 |
|
|
117693280 |
rummansadik |
C1 |
May 28, 2021, 6:07 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
109 |
2560000 |
|
|
117698620 |
tayyrov |
C1 |
May 28, 2021, 7:03 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
109 |
2764800 |
|
|
117698049 |
Leggasick |
C1 |
May 28, 2021, 6:55 p.m. |
OK |
PyPy 3 |
TESTS |
19 |
109 |
2969600 |
|
|
117696185 |
Cypher_Ani |
C1 |
May 28, 2021, 6:35 p.m. |
OK |
Python 3 |
TESTS |
19 |
62 |
102400 |
|
|
117694236 |
vyas_samarth11 |
C1 |
May 28, 2021, 6:16 p.m. |
OK |
Python 3 |
TESTS |
19 |
62 |
102400 |
|
|
117689434 |
gouravtiwari237 |
C1 |
May 28, 2021, 5:35 p.m. |
OK |
Python 3 |
TESTS |
19 |
62 |
102400 |
|
|
117725220 |
sh1194 |
C1 |
May 29, 2021, 4:46 a.m. |
OK |
Python 3 |
TESTS |
19 |
62 |
102400 |
|
|
117722738 |
rautmare123 |
C1 |
May 29, 2021, 4:10 a.m. |
OK |
Python 3 |
TESTS |
19 |
62 |
102400 |
|
|
117701866 |
Andromeda758 |
C1 |
May 28, 2021, 7:50 p.m. |
OK |
Python 3 |
TESTS |
19 |
62 |
102400 |
|
|
117711763 |
neeraj_3 |
C1 |
May 29, 2021, 12:40 a.m. |
OK |
Python 3 |
TESTS |
19 |
62 |
204800 |
|
|
117728673 |
ShashankZobb |
C1 |
May 29, 2021, 5:27 a.m. |
OK |
Python 3 |
TESTS |
19 |
77 |
102400 |
|
|
117723039 |
punnasurya2000 |
C1 |
May 29, 2021, 4:15 a.m. |
OK |
Python 3 |
TESTS |
19 |
77 |
102400 |
|
|
117719385 |
TeraTau |
C1 |
May 29, 2021, 3:12 a.m. |
OK |
Python 3 |
TESTS |
19 |
77 |
102400 |
|
|
117686941 |
8r14z |
C1 |
May 28, 2021, 5:19 p.m. |
OK |
Python 3 + libs |
TESTS |
19 |
77 |
0 |
|
|
117697644 |
rpashuto |
C1 |
May 28, 2021, 6:51 p.m. |
OK |
Python 3 + libs |
TESTS |
19 |
77 |
0 |
|
|
117687901 |
8r14z |
C1 |
May 28, 2021, 5:25 p.m. |
OK |
Python 3 + libs |
TESTS |
19 |
77 |
0 |
|
|
117708645 |
IvanDyachenko |
C1 |
May 28, 2021, 10:26 p.m. |
OK |
Scala |
TESTS |
19 |
779 |
59084800 |
|
|
remove filters
Back to search problems