# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132775 | Vardanyan | Baloni (COCI15_baloni) | C++14 | 2070 ms | 8184 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;
const int N = 1000*1000+5;
int a[N];
bool col[N];
int main(){
ios_base::sync_with_stdio(false);
int n;
cin>>n;
for(int i = 1;i<=n;i++) cin>>a[i];
int ans = 0;
for(int i = 1;i<=n;i++){
if(col[i]) continue;
ans++;
int now = a[i];
now--;
for(int j = i+1;j<=n;j++){
if(a[j] == now){
col[j] = 1;
now--;
}
}
}
cout<<ans<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |