Submission #382947

# Submission time Handle Problem Language Result Execution time Memory
382947 2021-03-28T15:12:37 Z Alexandra Baloni (COCI15_baloni) Python 3
40 / 100
2000 ms 104828 KB
n = int(input())
h = input().split()
h = list(map(int, h))
resp = 0
rotos = []

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))
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2924 KB Output is correct
2 Correct 152 ms 3128 KB Output is correct
3 Correct 457 ms 3436 KB Output is correct
4 Correct 587 ms 3436 KB Output is correct
5 Execution timed out 2071 ms 93712 KB Time limit exceeded
6 Execution timed out 2094 ms 104828 KB Time limit exceeded
7 Execution timed out 2080 ms 83232 KB Time limit exceeded
8 Execution timed out 2095 ms 82432 KB Time limit exceeded
9 Execution timed out 2075 ms 89484 KB Time limit exceeded
10 Execution timed out 2091 ms 91268 KB Time limit exceeded