# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
162697 | Leonardo_Paes | Baloni (COCI15_baloni) | C++17 | 88 ms | 7288 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 maxn = 1e6+10;
bitset<maxn> mark;
int h[maxn];
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int n, ans=0;
cin >> n;
for(int i=1; i<=n; i++) cin >> h[i];
for(int i=n; i>=1; i--){
if(mark[h[i]-1]){
mark[h[i]-1] = false;
}
else{
ans++;
}
mark[h[i]] = true;
}
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |