# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
208387 | ArKCa | Baloni (COCI15_baloni) | C++17 | 295 ms | 7416 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;
int arr[1000005],cnt[1000005],ans;
int main(){
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=n-1;i>=0;i--){
if(cnt[arr[i]-1]==0){
ans++;
cnt[arr[i]]++;
}
else{
cnt[arr[i]-1]--;
cnt[arr[i]]++;
}
}
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |