# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132786 | Vardanyan | Baloni (COCI15_baloni) | C++14 | 126 ms | 28536 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];
vector<int> mark[N];
int main(){
ios_base::sync_with_stdio(false);
int n;
// cout<<0<<endl;
cin>>n;
for(int i = 1;i<=n;i++) cin>>a[i];
int ans = 0;
for(int i = 1;i<=n;i++){
int x = a[i];
if(mark[x+1].size() == 0){
mark[x].push_back(i);
ans++;
continue;
}
mark[x+1].pop_back();
mark[x].push_back(i);
}
cout<<ans<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |