Submission #382970

#TimeUsernameProblemLanguageResultExecution timeMemory
382970AlexandraBaloni (COCI15_baloni)Cpython 3
40 / 100
2097 ms104764 KiB
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 = min(h) arrow = target + 1 o = h.index(target) rotos.append(o) resp += 1 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...