# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231577 | huangqr | Baloni (COCI15_baloni) | C++14 | 281 ms | 8312 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;
ll x[asize];
bool y[asize];
int main(){
ll n,k,ans;
cin>>n;
ans=n;
for(ll i=0;i<asize;i++)x[i]=1e9;
for(ll i=0;i<n;i++){
cin>>k;
if(y[k]==1)ans--;
x[k]=min(x[k],i);
y[k]=1;
}
for(ll i=1;i<asize;i++){
if(y[i]&&y[i-1]&&x[i]<x[i-1])ans--;
}
cout<<ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |