n = int(input())
h = input().split()
h = list(map(int, h))
resp = 0
rotos = []
try:
for i in range (len(h)):
rotos = []
target = min(h)
arrow = target + 1
o = h.index(target)
h.pop(o)
resp += 1
if h.index(min(h)) < o:
for j in range (o-1, -1, -1):
if h[j] == arrow:
arrow += 1
rotos.append(j)
rotos.sort(reverse=True)
for j in range (len(rotos)):
h.pop(rotos[j])
print (str(resp))
except:
print (str(resp))
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
54 ms |
2924 KB |
Output isn't correct |
2 |
Incorrect |
148 ms |
3180 KB |
Output isn't correct |
3 |
Incorrect |
458 ms |
3368 KB |
Output isn't correct |
4 |
Incorrect |
600 ms |
3436 KB |
Output isn't correct |
5 |
Execution timed out |
2073 ms |
93660 KB |
Time limit exceeded |
6 |
Execution timed out |
2079 ms |
104700 KB |
Time limit exceeded |
7 |
Execution timed out |
2041 ms |
83232 KB |
Time limit exceeded |
8 |
Execution timed out |
2077 ms |
82568 KB |
Time limit exceeded |
9 |
Execution timed out |
2092 ms |
89544 KB |
Time limit exceeded |
10 |
Execution timed out |
2094 ms |
91276 KB |
Time limit exceeded |