# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
382994 | victoriad | Baloni (COCI15_baloni) | C++14 | 2097 ms | 3948 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 <fstream>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <queue>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
vector<bool>p(n,false);
int x=0;
vector<int>a(n);
for(int i=0;i<n;i++){
cin>>a[i];
}
int y;
for(int i=0;i<n;i++){
if(p[i])continue;
x++;
p[i]=true;
y=a[i]-1;
for(int j=i+1;j<n;j++){
if(!p[j]&&a[j]==y){
p[j]=true;
y--;
if(y==0)break;
}
}
}
cout<<x;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |