# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88794 | asifthegreat | Baloni (COCI15_baloni) | C++14 | 2054 ms | 4212 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |