Submission #1112520

# Submission time Handle Problem Language Result Execution time Memory
1112520 2024-11-14T09:24:49 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=0;
    
    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)+1;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 336 KB Output isn't correct
2 Incorrect 5 ms 444 KB Output isn't correct
3 Incorrect 13 ms 508 KB Output isn't correct
4 Incorrect 28 ms 524 KB Output isn't correct
5 Incorrect 1390 ms 6480 KB Output isn't correct
6 Execution timed out 2053 ms 7424 KB Time limit exceeded
7 Execution timed out 2072 ms 6216 KB Time limit exceeded
8 Execution timed out 2068 ms 6080 KB Time limit exceeded
9 Execution timed out 2051 ms 6452 KB Time limit exceeded
10 Execution timed out 2062 ms 6480 KB Time limit exceeded