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'Pak Chanek is participating in a lemper cooking competition. In the competition, Pak Chanek has to cook lempers with N stoves that are arranged sequentially from stove 1 to stove N . Initially, stove i has a temperature of A_i degrees. A stove can have a negative temperature. Pak Chanek realises that, in order for his lempers to be cooked, he needs to keep the temperature of each stove at a non-negative value. To make it happen, Pak Chanek can do zero or more operations. In one operation, Pak Chanek chooses one stove i with 2 <= q i <= q N-1 , then: Pak Chanek wants to know the minimum number of operations he needs to do such that the temperatures of all stoves are at non-negative values. Help Pak Chanek by telling him the minimum number of operations needed or by reporting if it is not possible to do. The first line contains a single integer N ( 1 <= N <= 10^5 ) -- the number of stoves. The second line contains N integers A_1, A_2, ldots, A_N ( -10^9 <= q A_i <= q 10^9 ) -- the initial temperatures of the stoves. Output an integer representing the minimum number of operations needed to make the temperatures of all stoves at non-negative values or output -1 if it is not possible. For the first example, a sequence of operations that can be done is as follows: There is no other sequence of operations such that the number of operations needed is fewer than 4 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
170857345 |
kaiboy rainboy Dukkha |
L |
Sept. 4, 2022, 2:36 p.m. |
OK |
GNU C11 |
TESTS |
24 |
62 |
1638400 |
|
|
170872649 |
IcMtr _Rekoirive bcr_233 |
L |
Sept. 4, 2022, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
46 |
1945600 |
|
|
170862828 |
_dlbm17 _Fake4Fun StayFocus |
L |
Sept. 4, 2022, 3:13 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
62 |
2867200 |
|
|
170870050 |
faqak Summer_ring |
L |
Sept. 4, 2022, 4:12 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
62 |
3174400 |
|
|
170853780 |
MatrixCascade_qwq themoon |
L |
Sept. 4, 2022, 2:16 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
78 |
1536000 |
|
|
170847542 |
Mr_Eight wangziji Qingyu |
L |
Sept. 4, 2022, 1:47 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
78 |
6451200 |
|
|
170853155 |
yoy68 y0y68 Suffocating |
L |
Sept. 4, 2022, 2:12 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
78 |
65126400 |
|
|
170870211 |
1potato2potato rzirvi13 omeganot |
L |
Sept. 4, 2022, 4:13 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
249 |
10649600 |
|
|
170884162 |
Bobocan |
L |
Sept. 4, 2022, 6:34 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
30 |
2560000 |
|
|
170885983 |
Bobocan |
L |
Sept. 4, 2022, 6:57 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
31 |
3379200 |
|
|
170894251 |
thoi_bay_corona |
L |
Sept. 4, 2022, 9:16 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
46 |
2048000 |
|
|
170864672 |
Agreb |
L |
Sept. 4, 2022, 3:27 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
46 |
3174400 |
|
|
170908887 |
BigFaceDog |
L |
Sept. 5, 2022, 4:16 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
46 |
7168000 |
|
|
170910479 |
Mkswll |
L |
Sept. 5, 2022, 4:53 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
46 |
7168000 |
|
|
170879930 |
fenzhang hiwang123 spentplaying |
L |
Sept. 4, 2022, 5:48 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
62 |
2457600 |
|
|
170851526 |
yyljkydr Suika_predator oipotato |
L |
Sept. 4, 2022, 2:04 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
62 |
3276800 |
|
|
170880577 |
anhkha2003 apgpsoop minhnguyenxuan60 |
L |
Sept. 4, 2022, 5:56 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
62 |
3891200 |
|
|
170880516 |
realcomplex Valters07 ansisgustavs2 |
L |
Sept. 4, 2022, 5:55 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
77 |
3993600 |
|
|
170855022 |
PIachta Sophie_Neuenmuller |
L |
Sept. 4, 2022, 2:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
31 |
20377600 |
|
|
170855445 |
bashkort |
L |
Sept. 4, 2022, 2:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
46 |
2048000 |
|
|
170859546 |
PCTprobability Puranya_ nok0 |
L |
Sept. 4, 2022, 2:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
46 |
2457600 |
|
|
170849830 |
HollwoQ_Pelw khuepr123 thenymphsofdelphi |
L |
Sept. 4, 2022, 1:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
46 |
2457600 |
|
|
170862348 |
kotatsugame |
L |
Sept. 4, 2022, 3:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
46 |
3174400 |
|
|
170861711 |
rapira FeggieBoss Astronomax |
L |
Sept. 4, 2022, 3:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
46 |
3174400 |
|
|
170880827 |
errorgorn |
L |
Sept. 4, 2022, 5:59 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
46 |
3788800 |
|
|
170867828 |
pachico |
L |
Sept. 4, 2022, 3:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
46 |
4812800 |
|
|
170883861 |
potato167 |
L |
Sept. 4, 2022, 6:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
78 |
3072000 |
|
|
170874999 |
Ivan_len clam socho |
L |
Sept. 4, 2022, 4:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
217 |
5017600 |
|
|
170871173 |
Wolfycz Thallium54 |
L |
Sept. 4, 2022, 4:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
2048000 |
|
|
170876199 |
Nero |
L |
Sept. 4, 2022, 5:06 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
2867200 |
|
|
170858110 |
Heltion |
L |
Sept. 4, 2022, 2:41 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
5017600 |
|
|
170858479 |
altunyanv zidder _LeMur_ |
L |
Sept. 4, 2022, 2:43 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
5427200 |
|
|
170871028 |
MrBrionix |
L |
Sept. 4, 2022, 4:20 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
5836800 |
|
|
170853395 |
Batrr mhq 353cerega |
L |
Sept. 4, 2022, 2:14 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
6246400 |
|
|
170848830 |
I_LOVE_DASHA_KARPENKO Wailydest oleh1421 |
L |
Sept. 4, 2022, 1:52 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
9420800 |
|
|
170865116 |
alek0618 RGB_ICPC7 RGB_ICPC1 |
L |
Sept. 4, 2022, 3:31 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
24064000 |
|
|
170913447 |
geospiza |
L |
Sept. 5, 2022, 5:56 a.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
31 |
24064000 |
|
|
170863846 |
A_G |
L |
Sept. 4, 2022, 3:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
24 |
46 |
2048000 |
|
|
170848232 |
arvindf232 happypotato1207 nicholask |
L |
Sept. 4, 2022, 1:50 p.m. |
OK |
Kotlin 1.6 |
TESTS |
24 |
358 |
11059200 |
|
|
remove filters
Back to search problems