제출 #382978

#제출 시각아이디문제언어결과실행 시간메모리
382978AlexandraBaloni (COCI15_baloni)Cpython 3
0 / 100
2094 ms104700 KiB
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))
#Verdict Execution timeMemoryGrader output
Fetching results...