# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
162699 | Leonardo_Paes | Baloni (COCI15_baloni) | C++17 | 85 ms | 3960 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;
int h[maxn], mark[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]--;
}
else{
ans++;
}
mark[h[i]]++;
}
cout << ans << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |