답안 #1112546

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112546 2024-11-14T09:52:07 Z vjudge1 Baloni (COCI15_baloni) C++17
0 / 100
2000 ms 7424 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long


    int n;
    
    int ok=0;
    
int dan(int a[]){
    int ok=0;
    int sym=1;
    
    for(int i=0;i<n;i++){
        if(a[i]!=0){ok=a[i]; break;}
    }
    
    for(int i=0;i<n;i++){
        if(ok==a[i]){
            a[i]=0;
            ok-=1;
        }
        
    }
    
    for(int i=0;i<n;i++){
        if(a[i]!=0){
            sym+=1;
            dan(a);
        }
    }
    return sym;
}

int32_t main()
{
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++) cin>>a[i];
    
    cout<<dan(a);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 336 KB Output isn't correct
2 Incorrect 5 ms 336 KB Output isn't correct
3 Incorrect 13 ms 336 KB Output isn't correct
4 Incorrect 18 ms 336 KB Output isn't correct
5 Incorrect 1466 ms 6620 KB Output isn't correct
6 Execution timed out 2081 ms 7424 KB Time limit exceeded
7 Execution timed out 2061 ms 6236 KB Time limit exceeded
8 Execution timed out 2066 ms 6324 KB Time limit exceeded
9 Execution timed out 2074 ms 6224 KB Time limit exceeded
10 Execution timed out 2067 ms 6656 KB Time limit exceeded