답안 #541724

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541724 2022-03-24T09:18:59 Z daristyle Baloni (COCI15_baloni) C++11
30 / 100
2000 ms 4484 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, arrows=0, mx=0, r=0, h;
    cin>>n;
    int v[n];
    for(int i=1; i<=n; ++i){
        cin>>v[i];
        if(mx<v[i]) mx=v[i];
    }
    while(r!=n){
        h=mx;
        mx=0;
        arrows++;
        for(int i=1; i<=n && h; ++i){
            if(v[i]==h){
                v[i]=0;
                h--;
                r++;
            }
            if(v[i]>mx) mx=v[i];
        }
    }
    cout<<arrows;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 212 KB Output is correct
2 Execution timed out 2091 ms 212 KB Time limit exceeded
3 Execution timed out 2085 ms 212 KB Time limit exceeded
4 Execution timed out 2093 ms 212 KB Time limit exceeded
5 Correct 1272 ms 4144 KB Output is correct
6 Execution timed out 2023 ms 4484 KB Time limit exceeded
7 Execution timed out 2039 ms 3740 KB Time limit exceeded
8 Execution timed out 2029 ms 3676 KB Time limit exceeded
9 Correct 1862 ms 4024 KB Output is correct
10 Execution timed out 2076 ms 4076 KB Time limit exceeded