Submission #231577

#TimeUsernameProblemLanguageResultExecution timeMemory
231577huangqrBaloni (COCI15_baloni)C++14
0 / 100
281 ms8312 KiB
#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 timeMemoryGrader output
Fetching results...