Submission #231576

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