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"Monocarp is playing a computer game once again. He is a wizard apprentice, who only knows a single spell. Luckily, this spell can damage the monsters. The level he's currently on contains n monsters. The i -th of them appears k_i seconds after the start of the level and has h_i health points. As an additional constraint, h_i <= k_i for all 1 <= i <= n . All k_i are different. Monocarp can cast the spell at moments which are positive integer amounts of second after the start of the level: 1, 2, 3, ... The damage of the spell is calculated as follows. If he didn't cast the spell at the previous second, the damage is 1 . Otherwise, let the damage at the previous second be x . Then he can choose the damage to be either x + 1 or 1 . A spell uses mana: casting a spell with damage x uses x mana. Mana doesn't regenerate. To kill the i -th monster, Monocarp has to cast a spell with damage at least h_i at the exact moment the monster appears, which is k_i . Note that Monocarp can cast the spell even when there is no monster at the current second. The mana amount required to cast the spells is the sum of mana usages for all cast spells. Calculate the least amount of mana required for Monocarp to kill all monsters. It can be shown that it's always possible to kill all monsters under the constraints of the problem. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of testcases. The first line of the testcase contains a single integer n ( 1 <= n <= 100 ) -- the number of monsters in the level. The second line of the testcase contains n integers k_1 < k_2 < ... < k_n ( 1 <= k_i <= 10^9 ) -- the number of second from the start the i -th monster appears at. All k_i are different, k_i are provided in the increasing order. The third line of the testcase contains n integers h_1"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
143066024 |
WA_automata |
C |
Jan. 17, 2022, 5:57 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
8 |
46 |
0 |
|
|
143031188 |
ssvb |
C |
Jan. 16, 2022, 5:47 p.m. |
OK |
D |
TESTS |
8 |
31 |
1945600 |
|
|
143021218 |
rainboy |
C |
Jan. 16, 2022, 4:58 p.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
0 |
|
|
143025924 |
Linx. |
C |
Jan. 16, 2022, 5:11 p.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
0 |
|
|
143029064 |
HoshinoChiyvki |
C |
Jan. 16, 2022, 5:30 p.m. |
OK |
GNU C11 |
TESTS |
8 |
46 |
0 |
|
|
143023078 |
sgrfdfgryiu |
C |
Jan. 16, 2022, 5:02 p.m. |
OK |
GNU C11 |
TESTS |
8 |
108 |
0 |
|
|
143062269 |
waiiting |
C |
Jan. 17, 2022, 5:26 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143056404 |
nothing- |
C |
Jan. 17, 2022, 4:24 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143051007 |
applese |
C |
Jan. 17, 2022, 3:13 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143048201 |
xudong |
C |
Jan. 17, 2022, 2:23 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143048025 |
upctmc |
C |
Jan. 17, 2022, 2:19 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143047340 |
BARBARIANNNNN |
C |
Jan. 17, 2022, 2:04 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143046516 |
whilekim1 |
C |
Jan. 17, 2022, 1:43 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143058511 |
nitvjudge2 |
C |
Jan. 17, 2022, 4:47 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143061921 |
MediationalField |
C |
Jan. 17, 2022, 5:23 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143061884 |
xiayichen |
C |
Jan. 17, 2022, 5:22 a.m. |
OK |
GNU C++14 |
TESTS |
8 |
15 |
0 |
|
|
143066086 |
WA_automata |
C |
Jan. 17, 2022, 5:57 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143063350 |
strglntoexist |
C |
Jan. 17, 2022, 5:35 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143062656 |
Hitesh_3578 |
C |
Jan. 17, 2022, 5:29 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143062049 |
YLone |
C |
Jan. 17, 2022, 5:24 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143061646 |
Vagray |
C |
Jan. 17, 2022, 5:20 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143061079 |
_GOAT_ |
C |
Jan. 17, 2022, 5:15 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143060494 |
Faiths |
C |
Jan. 17, 2022, 5:10 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143058541 |
cuteday |
C |
Jan. 17, 2022, 4:47 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143066423 |
bkifhr6 |
C |
Jan. 17, 2022, 6 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143065931 |
oggy_love_oly |
C |
Jan. 17, 2022, 5:56 a.m. |
OK |
GNU C++17 |
TESTS |
8 |
15 |
0 |
|
|
143037324 |
Evang |
C |
Jan. 16, 2022, 6:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
0 |
|
|
143019131 |
tonyli00000 |
C |
Jan. 16, 2022, 3:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
0 |
0 |
|
|
143064106 |
OR-chi |
C |
Jan. 17, 2022, 5:41 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
0 |
|
|
143065918 |
AkaMG |
C |
Jan. 17, 2022, 5:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
0 |
|
|
143065094 |
CODERGARV |
C |
Jan. 17, 2022, 5:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
0 |
|
|
143054732 |
NinjaSenpai |
C |
Jan. 17, 2022, 4:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
0 |
|
|
143054520 |
NinjaSenpai |
C |
Jan. 17, 2022, 4:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
0 |
|
|
143054323 |
GreyMatter14 |
C |
Jan. 17, 2022, 3:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
0 |
|
|
143052779 |
BhaTTa |
C |
Jan. 17, 2022, 3:38 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
0 |
|
|
143051139 |
cherish. |
C |
Jan. 17, 2022, 3:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
8 |
15 |
0 |
|
|
143048809 |
imalok10 |
C |
Jan. 17, 2022, 2:34 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
0 |
|
|
143026455 |
ch1ihnuf8e |
C |
Jan. 16, 2022, 5:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
0 |
|
|
143020851 |
SweetWitch |
C |
Jan. 16, 2022, 4:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
0 |
|
|
143062913 |
Zaid_25 |
C |
Jan. 17, 2022, 5:31 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
0 |
|
|
143064471 |
Setsuna |
C |
Jan. 17, 2022, 5:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
0 |
|
|
143051436 |
panzuguonb |
C |
Jan. 17, 2022, 3:20 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
0 |
|
|
143019187 |
gentoopenguinbird |
C |
Jan. 16, 2022, 3:43 p.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
0 |
102400 |
|
|
143065367 |
AcqingX |
C |
Jan. 17, 2022, 5:52 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
15 |
0 |
|
|
143064949 |
Baytoro |
C |
Jan. 17, 2022, 5:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
15 |
0 |
|
|
143065478 |
ak149159 |
C |
Jan. 17, 2022, 5:53 a.m. |
OK |
GNU C++20 (64) |
TESTS |
8 |
15 |
0 |
|
|
143028889 |
utuber |
C |
Jan. 16, 2022, 5:28 p.m. |
OK |
Go |
TESTS |
8 |
31 |
409600 |
|
|
143022936 |
aashay_03 |
C |
Jan. 16, 2022, 5:01 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
0 |
|
|
143019787 |
Cures |
C |
Jan. 16, 2022, 3:44 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
0 |
|
|
143032837 |
SaberXpro |
C |
Jan. 16, 2022, 6:01 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
0 |
|
|
143029686 |
Sandy_coder2001 |
C |
Jan. 16, 2022, 5:34 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
0 |
|
|
143026371 |
MubtasimShahriar |
C |
Jan. 16, 2022, 5:13 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
0 |
|
|
143026039 |
Fareedah |
C |
Jan. 16, 2022, 5:11 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
0 |
|
|
143020770 |
ND_ |
C |
Jan. 16, 2022, 4:58 p.m. |
OK |
Java 11 |
TESTS |
8 |
171 |
0 |
|
|
143033485 |
anjroo |
C |
Jan. 16, 2022, 6:08 p.m. |
OK |
Java 11 |
TESTS |
8 |
186 |
0 |
|
|
143037039 |
_ryan18_ |
C |
Jan. 16, 2022, 6:53 p.m. |
OK |
Java 11 |
TESTS |
8 |
187 |
0 |
|
|
143037137 |
sahilgupta2201 |
C |
Jan. 16, 2022, 6:54 p.m. |
OK |
Java 11 |
TESTS |
8 |
187 |
0 |
|
|
143029773 |
Ghost_Fox_Sledgehammer |
C |
Jan. 16, 2022, 5:35 p.m. |
OK |
Java 8 |
TESTS |
8 |
93 |
0 |
|
|
143028428 |
beroul |
C |
Jan. 16, 2022, 5:25 p.m. |
OK |
Java 8 |
TESTS |
8 |
93 |
0 |
|
|
143027671 |
gautam.abhinav36 |
C |
Jan. 16, 2022, 5:20 p.m. |
OK |
Java 8 |
TESTS |
8 |
109 |
0 |
|
|
143027320 |
DoPractice |
C |
Jan. 16, 2022, 5:18 p.m. |
OK |
Java 8 |
TESTS |
8 |
109 |
0 |
|
|
143064120 |
ak_ankit |
C |
Jan. 17, 2022, 5:41 a.m. |
OK |
Java 8 |
TESTS |
8 |
109 |
0 |
|
|
143035817 |
kasyu |
C |
Jan. 16, 2022, 6:35 p.m. |
OK |
Java 8 |
TESTS |
8 |
109 |
0 |
|
|
143034932 |
livd |
C |
Jan. 16, 2022, 6:24 p.m. |
OK |
Java 8 |
TESTS |
8 |
109 |
0 |
|
|
143057844 |
kbadrinath |
C |
Jan. 17, 2022, 4:40 a.m. |
OK |
Java 8 |
TESTS |
8 |
124 |
0 |
|
|
143027400 |
vgrechko |
C |
Jan. 16, 2022, 5:18 p.m. |
OK |
Java 8 |
TESTS |
8 |
124 |
0 |
|
|
143052175 |
zxz_xmx |
C |
Jan. 17, 2022, 3:30 a.m. |
OK |
Java 8 |
TESTS |
8 |
124 |
0 |
|
|
143022893 |
ostroumov |
C |
Jan. 16, 2022, 5:01 p.m. |
OK |
Kotlin 1.4 |
TESTS |
8 |
171 |
0 |
|
|
143038468 |
Nuklinoid |
C |
Jan. 16, 2022, 8:17 p.m. |
OK |
Mono C# |
TESTS |
8 |
77 |
2969600 |
|
|
143040168 |
LycheeBTTP |
C |
Jan. 16, 2022, 9:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
31 |
0 |
|
|
143018689 |
Agumon |
C |
Jan. 16, 2022, 3:42 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
31 |
32051200 |
|
|
143022244 |
psn2706 |
C |
Jan. 16, 2022, 5 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
46 |
204800 |
|
|
143019370 |
MountainBike |
C |
Jan. 16, 2022, 3:43 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
61 |
0 |
|
|
143053500 |
A_Pier |
C |
Jan. 17, 2022, 3:48 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
61 |
0 |
|
|
143038163 |
dominotim |
C |
Jan. 16, 2022, 8:07 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
61 |
0 |
|
|
143026847 |
fatant |
C |
Jan. 16, 2022, 5:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
61 |
0 |
|
|
143051903 |
qing_lin |
C |
Jan. 17, 2022, 3:26 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
62 |
0 |
|
|
143052928 |
kun2605879979 |
C |
Jan. 17, 2022, 3:40 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
77 |
0 |
|
|
143050118 |
bkifhr10 |
C |
Jan. 17, 2022, 2:59 a.m. |
OK |
MS C++ 2017 |
TESTS |
8 |
77 |
0 |
|
|
143050992 |
Seungho |
C |
Jan. 17, 2022, 3:13 a.m. |
OK |
.NET Core C# |
TESTS |
8 |
108 |
3072000 |
|
|
143032310 |
jeroeng |
C |
Jan. 16, 2022, 5:56 p.m. |
OK |
.NET Core C# |
TESTS |
8 |
139 |
3174400 |
|
|
143025351 |
OLOGY |
C |
Jan. 16, 2022, 5:08 p.m. |
OK |
PyPy 2 |
TESTS |
8 |
187 |
3993600 |
|
|
143026366 |
ergatis |
C |
Jan. 16, 2022, 5:13 p.m. |
OK |
PyPy 2 |
TESTS |
8 |
249 |
2867200 |
|
|
143031904 |
tanuki_10 |
C |
Jan. 16, 2022, 5:53 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
124 |
4812800 |
|
|
143031923 |
sushmanth.dampur8780 |
C |
Jan. 16, 2022, 5:53 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
140 |
5017600 |
|
|
143021202 |
Bad_day_toCode |
C |
Jan. 16, 2022, 4:58 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
155 |
4915200 |
|
|
143025437 |
lebron87 |
C |
Jan. 16, 2022, 5:09 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
170 |
6144000 |
|
|
143048794 |
ambs_ |
C |
Jan. 17, 2022, 2:34 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
171 |
5529600 |
|
|
143035319 |
unknownSolver |
C |
Jan. 16, 2022, 6:29 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
171 |
5632000 |
|
|
143032570 |
Beacon |
C |
Jan. 16, 2022, 5:59 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
171 |
6041600 |
|
|
143025075 |
arijeetghosh251 |
C |
Jan. 16, 2022, 5:07 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
171 |
6041600 |
|
|
143046869 |
uuuu_s |
C |
Jan. 17, 2022, 1:52 a.m. |
OK |
PyPy 3 |
TESTS |
8 |
171 |
7168000 |
|
|
143023287 |
tarun_aren |
C |
Jan. 16, 2022, 5:02 p.m. |
OK |
PyPy 3 |
TESTS |
8 |
171 |
7782400 |
|
|
143036779 |
lemiao12 |
C |
Jan. 16, 2022, 6:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
109 |
4505600 |
|
|
143019659 |
IkshitG |
C |
Jan. 16, 2022, 3:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
124 |
4608000 |
|
|
143021816 |
viraldoshi |
C |
Jan. 16, 2022, 4:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
124 |
6553600 |
|
|
143031151 |
pglutz |
C |
Jan. 16, 2022, 5:46 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
139 |
7168000 |
|
|
143038650 |
KA_Rma |
C |
Jan. 16, 2022, 8:23 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
171 |
8499200 |
|
|
143024178 |
Greyhound |
C |
Jan. 16, 2022, 5:04 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
171 |
9216000 |
|
|
143023168 |
batnik |
C |
Jan. 16, 2022, 5:02 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
171 |
9932800 |
|
|
143027252 |
WitchOfTruth |
C |
Jan. 16, 2022, 5:18 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
171 |
10137600 |
|
|
143021571 |
omshriwhoishe |
C |
Jan. 16, 2022, 4:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
171 |
10137600 |
|
|
143027752 |
oadey89 |
C |
Jan. 16, 2022, 5:21 p.m. |
OK |
PyPy 3-64 |
TESTS |
8 |
171 |
10854400 |
|
|
143025932 |
OLOGY |
C |
Jan. 16, 2022, 5:11 p.m. |
OK |
Python 2 |
TESTS |
8 |
77 |
1433600 |
|
|
143028177 |
Orn0 |
C |
Jan. 16, 2022, 5:23 p.m. |
OK |
Python 3 |
TESTS |
8 |
62 |
204800 |
|
|
143049171 |
continue_and_break |
C |
Jan. 17, 2022, 2:42 a.m. |
OK |
Python 3 |
TESTS |
8 |
93 |
204800 |
|
|
143029357 |
mikasaloveseren |
C |
Jan. 16, 2022, 5:32 p.m. |
OK |
Python 3 |
TESTS |
8 |
124 |
512000 |
|
|
143020683 |
ghannu |
C |
Jan. 16, 2022, 4:58 p.m. |
OK |
Python 3 |
TESTS |
8 |
140 |
0 |
|
|
143021159 |
satyamshrma |
C |
Jan. 16, 2022, 4:58 p.m. |
OK |
Python 3 |
TESTS |
8 |
140 |
102400 |
|
|
143037965 |
MuhammedKamalAbdElrhman |
C |
Jan. 16, 2022, 8 p.m. |
OK |
Python 3 |
TESTS |
8 |
155 |
0 |
|
|
143037747 |
mihir111p |
C |
Jan. 16, 2022, 7:53 p.m. |
OK |
Python 3 |
TESTS |
8 |
155 |
0 |
|
|
143031839 |
KingMace |
C |
Jan. 16, 2022, 5:52 p.m. |
OK |
Python 3 |
TESTS |
8 |
155 |
0 |
|
|
143057917 |
sbs2001 |
C |
Jan. 17, 2022, 4:41 a.m. |
OK |
Python 3 |
TESTS |
8 |
170 |
0 |
|
|
143020650 |
NS3081992 |
C |
Jan. 16, 2022, 4:58 p.m. |
OK |
Python 3 |
TESTS |
8 |
170 |
102400 |
|
|
143038618 |
kumalimak |
C |
Jan. 16, 2022, 8:22 p.m. |
OK |
Rust 2021 |
TESTS |
8 |
15 |
102400 |
|
|
143022696 |
Avanta |
C |
Jan. 16, 2022, 5:01 p.m. |
OK |
Rust 2021 |
TESTS |
8 |
31 |
0 |
|
|
143023937 |
maan2003 |
C |
Jan. 16, 2022, 5:04 p.m. |
OK |
Rust 2021 |
TESTS |
8 |
61 |
0 |
|
|
143040626 |
clause |
C |
Jan. 16, 2022, 9:33 p.m. |
OK |
Rust 2021 |
TESTS |
8 |
108 |
0 |
|
|
remove filters
Back to search problems