# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231576 | huangqr | Baloni (COCI15_baloni) | C++14 | 287 ms | 7800 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;
typedef long long ll;
const ll asize=1e6+5;
int h[asize];
bool y[asize];
int main(){
int n,k,ans;
cin>>n;
ans=n;
for(int i=0;i<asize;i++)h[i]=1e9;
for(int i=0;i<n;i++){
cin>>k;
if(!y[k])h[k]=i;
else ans--;
y[k]=1;
}
for(int i=1;i<asize;i++){
if(y[i]&&y[i-1]&&h[i]<h[i-1])ans--;
}
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |