Submission #162698

#TimeUsernameProblemLanguageResultExecution timeMemory
162698wjoaoBaloni (COCI15_baloni)C++11
100 / 100
357 ms3832 KiB
#include<bits/stdc++.h> #define maxn 1000100 using namespace std; int mark[maxn], a, entrada[maxn], n; int main(){ cin >> n; int res = 0; for(int i =0 ; i < n; i++){ cin >> entrada[i]; } for(int i = n-1; i>= 0; i--){ int h = entrada[i]; if( mark[h-1] > 0 ){ mark[h-1]--; }else{ res++; } mark[h]++; } cout << res << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...