답안 #382948

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
382948 2021-03-28T15:16:37 Z Alexandra Baloni (COCI15_baloni) Python 3
40 / 100
2000 ms 104836 KB
n = int(input())
h = input().split()
h = list(map(int, h))
resp = 0
rotos = []

aux = []
for i in range (n):
  aux.append(h[i])

aux.sort()
if aux==h:
  print (str(n))

else:
  try:
    for i in range (len(h)):
      rotos = []
      target = max(h)
      arrow = target - 1
      o = h.index(target)
      rotos.append(o)
      resp += 1

      for j in range (o+1, len(h)):
        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 Correct 57 ms 2944 KB Output is correct
2 Correct 147 ms 3180 KB Output is correct
3 Correct 445 ms 3308 KB Output is correct
4 Correct 605 ms 3436 KB Output is correct
5 Execution timed out 2081 ms 93708 KB Time limit exceeded
6 Execution timed out 2075 ms 104836 KB Time limit exceeded
7 Execution timed out 2080 ms 83236 KB Time limit exceeded
8 Execution timed out 2097 ms 82436 KB Time limit exceeded
9 Execution timed out 2089 ms 89568 KB Time limit exceeded
10 Execution timed out 2093 ms 91276 KB Time limit exceeded