Submission #132785

#TimeUsernameProblemLanguageResultExecution timeMemory
132785VardanyanBaloni (COCI15_baloni)C++14
0 / 100
118 ms131076 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1000*1000+5; int a[N]; bool col[N]; queue<int> mark[N]; int main(){ ios_base::sync_with_stdio(false); int n; // cout<<0<<endl; cin>>n; for(int i = 1;i<=n;i++) cin>>a[i]; int ans = 0; for(int i = 1;i<=n;i++){ int x = a[i]; if(mark[x+1].size() == 0){ mark[x].push(i); ans++; continue; } mark[x+1].pop(); mark[x].push(i); } cout<<ans<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...