Submission #88794

# Submission time Handle Problem Language Result Execution time Memory
88794 2018-12-08T19:18:45 Z asifthegreat Baloni (COCI15_baloni) C++14
0 / 100
2000 ms 4212 KB
#include <bits/stdc++.h>
using namespace std;

#define debug(a) cout << #a << " = " << a << endl

const int N = 1000004;

int ara[N],n;
bitset<1000003>taken;

int main()
{
    scanf("%d",&n);
    for(int i = 0; i < n;i++)scanf("%d",&ara[i]);
    int cnt = 0;
    for(int i = 0;i < n;i++){
        if(taken[i])continue;
       // debug(i);
        //printf("%d te ekta marlam\n",i);
        taken[i] = true;
        cnt++;
        int ase_naki = ara[i]-1;
        //debug(ase_naki);
        for(int j = i+1;j < n;j++){
            if(ara[j] == ase_naki){
                taken[j] = true;
                ase_naki--;
                //cout << j <<  " ........\n";
                //debug(ase_naki);
            }
        }
    }   
    cout << cnt << endl;




    return 0;
}

Compilation message

baloni.cpp: In function 'int main()':
baloni.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
baloni.cpp:14:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 0; i < n;i++)scanf("%d",&ara[i]);
                              ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 3 ms 372 KB Output isn't correct
3 Incorrect 7 ms 576 KB Output isn't correct
4 Incorrect 9 ms 576 KB Output isn't correct
5 Execution timed out 2041 ms 3728 KB Time limit exceeded
6 Execution timed out 2047 ms 4212 KB Time limit exceeded
7 Execution timed out 2054 ms 4212 KB Time limit exceeded
8 Execution timed out 2051 ms 4212 KB Time limit exceeded
9 Execution timed out 2045 ms 4212 KB Time limit exceeded
10 Execution timed out 2048 ms 4212 KB Time limit exceeded