Submission #956180

#TimeUsernameProblemLanguageResultExecution timeMemory
956180lalig777Baloni (COCI15_baloni)C++14
100 / 100
135 ms7268 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long int ll; int main(){ int n, ans=0; cin>>n; vector<int>v(1e6, 0); while (n--){ int a; cin>>a; if (v[a-1]>0){ v[a-1]--; if (a-2>=0) v[a-2]++; }else{ ans++; if (a-2>=0) v[a-2]++; } }cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...