답안 #162372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
162372 2019-11-07T19:03:23 Z boolodifjenula Baloni (COCI15_baloni) Python 3
0 / 100
2000 ms 95120 KB
n=int(input())
L=list(map(int,input().split()))
s=0
g1=L[0]
m=sum(L)
while m:
    s+=1
    g=g1
    g1=0
    for i in range(len(L)):
        if g==L[i]:
            g-=1
            m-=L[i]
            L[i]=0
        elif g1==0:
            g1=L[i]
        if g<1 and g1 or g1 and i+1<n and g<min(L[i+1:]):
            break
print(s)
        
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2056 ms 3384 KB Time limit exceeded
2 Execution timed out 2069 ms 3512 KB Time limit exceeded
3 Execution timed out 2070 ms 3640 KB Time limit exceeded
4 Execution timed out 2065 ms 3768 KB Time limit exceeded
5 Execution timed out 2054 ms 87996 KB Time limit exceeded
6 Execution timed out 2066 ms 95120 KB Time limit exceeded
7 Execution timed out 2056 ms 77852 KB Time limit exceeded
8 Execution timed out 2074 ms 77108 KB Time limit exceeded
9 Execution timed out 2067 ms 83720 KB Time limit exceeded
10 Execution timed out 2059 ms 85268 KB Time limit exceeded