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"Gildong is now developing a puzzle game. The puzzle consists of n platforms numbered from 1 to n . The player plays the game as a character that can stand on each platform and the goal of the game is to move the character from the 1 -st platform to the n -th platform. The i -th platform is labeled with an integer a_i ( 0 <= a_i <= n-i ). When the character is standing on the i -th platform, the player can move the character to any of the j -th platforms where i+1 <= j <= i+a_i . If the character is on the i -th platform where a_i=0 and i ne n , the player loses the game. Since Gildong thinks the current game is not hard enough, he wants to make it even harder. He wants to change some (possibly zero) labels to 0 so that there remains exactly one way to win. He wants to modify the game as little as possible, so he's asking you to find the minimum number of platforms that should have their labels changed. Two ways are different if and only if there exists a platform the character gets to in one way but not in the other way. Each test contains one or more test cases. The first line contains the number of test cases t ( 1 <= t <= 500 ). Each test case contains two lines. The first line of each test case consists of an integer n ( 2 <= n <= 3000 ) -- the number of platforms of the game. The second line of each test case contains n integers. The i -th integer is a_i ( 0 <= a_i <= n-i ) -- the integer of the i -th platform. It is guaranteed that: For each test case, print one integer -- the minimum number of different labels that should be changed to 0 so that there remains exactly one way to win. In the first case, the player can only move to the next platform until they get to the 4 -th platform. Since there is already only one way to win, the answer is zero. In the second case, Gildong can change a_2 , a_"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
100380285 |
rainboy |
F |
Dec. 4, 2020, 2:54 p.m. |
OK |
GNU C11 |
TESTS |
64 |
62 |
36147200 |
|
|
100407795 |
YJJ_Konnyaku |
F |
Dec. 4, 2020, 11:32 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
46 |
36249600 |
|
|
100410712 |
hangyesheng |
F |
Dec. 5, 2020, 2:11 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
46 |
36249600 |
|
|
100414779 |
Hello_zhr |
F |
Dec. 5, 2020, 4:19 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
46 |
144793600 |
|
|
100409620 |
anodiebird |
F |
Dec. 5, 2020, 1:25 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
61 |
37273600 |
|
|
100409638 |
2919805063 |
F |
Dec. 5, 2020, 1:26 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
61 |
37273600 |
|
|
100384810 |
Depth_First_Search |
F |
Dec. 4, 2020, 3:15 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
62 |
36249600 |
|
|
100385977 |
jiangxuancheng |
F |
Dec. 4, 2020, 3:19 p.m. |
OK |
GNU C++11 |
TESTS |
64 |
62 |
36249600 |
|
|
100408149 |
with |
F |
Dec. 5, 2020, midnight |
OK |
GNU C++11 |
TESTS |
64 |
77 |
36864000 |
|
|
100414084 |
xsdns |
F |
Dec. 5, 2020, 4 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
77 |
52940800 |
|
|
100412814 |
Ger123 |
F |
Dec. 5, 2020, 3:21 a.m. |
OK |
GNU C++11 |
TESTS |
64 |
78 |
37888000 |
|
|
100413750 |
chenfu1234 |
F |
Dec. 5, 2020, 3:50 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
61 |
36249600 |
|
|
100411686 |
WNJXYK |
F |
Dec. 5, 2020, 2:45 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
61 |
37273600 |
|
|
100409544 |
Prof_BL |
F |
Dec. 5, 2020, 1:21 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
62 |
36147200 |
|
|
100406899 |
Danzev |
F |
Dec. 4, 2020, 10:39 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
62 |
36249600 |
|
|
100390112 |
zadp |
F |
Dec. 4, 2020, 4:19 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
77 |
36249600 |
|
|
100412967 |
Funny_digit |
F |
Dec. 5, 2020, 3:26 a.m. |
OK |
GNU C++14 |
TESTS |
64 |
77 |
36249600 |
|
|
100390703 |
hoangtung_pbc |
F |
Dec. 4, 2020, 4:26 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
78 |
72396800 |
|
|
100390893 |
hoangtung_pbc |
F |
Dec. 4, 2020, 4:29 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
78 |
72396800 |
|
|
100383609 |
axp |
F |
Dec. 4, 2020, 3:10 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
78 |
72499200 |
|
|
100387753 |
L.O.V.E. |
F |
Dec. 4, 2020, 3:52 p.m. |
OK |
GNU C++14 |
TESTS |
64 |
78 |
72704000 |
|
|
100390605 |
neko123456 |
F |
Dec. 4, 2020, 4:25 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
61 |
37785600 |
|
|
100407154 |
RedDog739 |
F |
Dec. 4, 2020, 10:51 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
36044800 |
|
|
100413803 |
evenharder |
F |
Dec. 5, 2020, 3:52 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
36147200 |
|
|
100407437 |
peterr |
F |
Dec. 4, 2020, 11:09 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
36147200 |
|
|
100411035 |
richmaskus |
F |
Dec. 5, 2020, 2:23 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
36249600 |
|
|
100415289 |
90n |
F |
Dec. 5, 2020, 4:32 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
36352000 |
|
|
100388788 |
tempura0224 |
F |
Dec. 4, 2020, 4:05 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
36864000 |
|
|
100369425 |
nfssdq |
F |
Dec. 4, 2020, 2 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
72192000 |
|
|
100408171 |
timf1089 |
F |
Dec. 5, 2020, 12:01 a.m. |
OK |
GNU C++17 |
TESTS |
64 |
62 |
72192000 |
|
|
100392800 |
djm03178 |
F |
Dec. 4, 2020, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
64 |
77 |
36249600 |
|
|
100373667 |
wrinx |
F |
Dec. 4, 2020, 2:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
46 |
37376000 |
|
|
100412141 |
NMFF0B0H |
F |
Dec. 5, 2020, 3:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
61 |
36147200 |
|
|
100381543 |
Marckess |
F |
Dec. 4, 2020, 3 p.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
62 |
36249600 |
|
|
100373587 |
jiangly |
F |
Dec. 4, 2020, 2:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
62 |
37888000 |
|
|
100413956 |
rama_pang |
F |
Dec. 5, 2020, 3:57 a.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
62 |
37888000 |
|
|
100389962 |
4fecta |
F |
Dec. 4, 2020, 4:17 p.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
77 |
36249600 |
|
|
100378148 |
neal |
F |
Dec. 4, 2020, 2:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
77 |
37888000 |
|
|
100388189 |
Anus1373 |
F |
Dec. 4, 2020, 3:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
77 |
73011200 |
|
|
100375811 |
Heltion |
F |
Dec. 4, 2020, 2:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
92 |
72294400 |
|
|
100388056 |
Origenes |
F |
Dec. 4, 2020, 3:54 p.m. |
OK |
GNU C++17 (64) |
TESTS |
64 |
93 |
39116800 |
|
|
100392832 |
djm03178 |
F |
Dec. 4, 2020, 4:57 p.m. |
OK |
Java 8 |
TESTS |
64 |
171 |
39014400 |
|
|
100386112 |
LeoPro |
F |
Dec. 4, 2020, 3:19 p.m. |
OK |
Kotlin |
TESTS |
64 |
187 |
614400 |
|
|
100371415 |
Tlatoani |
F |
Dec. 4, 2020, 2:10 p.m. |
OK |
Kotlin |
TESTS |
64 |
421 |
77516800 |
|
|
100398520 |
sh1194 |
F |
Dec. 4, 2020, 6:34 p.m. |
OK |
PyPy 3 |
TESTS |
64 |
296 |
40345600 |
|
|
100398449 |
sh1194 |
F |
Dec. 4, 2020, 6:33 p.m. |
OK |
PyPy 3 |
TESTS |
64 |
296 |
40345600 |
|
|
100398433 |
sh1194 |
F |
Dec. 4, 2020, 6:33 p.m. |
OK |
PyPy 3 |
TESTS |
64 |
296 |
40345600 |
|
|
100392864 |
djm03178 |
F |
Dec. 4, 2020, 4:58 p.m. |
OK |
PyPy 3 |
TESTS |
64 |
296 |
40345600 |
|
|
100414381 |
mesaliason |
F |
Dec. 5, 2020, 4:08 a.m. |
OK |
PyPy 3 |
TESTS |
64 |
312 |
40755200 |
|
|
100418962 |
silvertint |
F |
Dec. 5, 2020, 5:46 a.m. |
OK |
PyPy 3 |
TESTS |
64 |
624 |
104243200 |
|
|
100385492 |
ezio_ |
F |
Dec. 4, 2020, 3:17 p.m. |
OK |
PyPy 3 |
TESTS |
64 |
888 |
79360000 |
|
|
remove filters
Back to search problems