Submission #568686

#TimeUsernameProblemLanguageResultExecution timeMemory
568686Garguy22Baloni (COCI15_baloni)C++17
0 / 100
204 ms3704 KiB
#include <iostream> using namespace std; const int MAXN = 1e6 + 7; int a[MAXN], f[MAXN]; int main() { int n; cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; int ans = 0; for(int i = n; i > 0; i--){ f[a[i]]++; if(f[a[i]-1] == 1) f[a[i]-1]--; else ans++; } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...