Submission #544697

#TimeUsernameProblemLanguageResultExecution timeMemory
544697AbdelmagedNourBaloni (COCI15_baloni)C++17
100 / 100
75 ms7304 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; int a[1000005],freq[1000005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin>>n; for(int i=0;i<n;i++)cin>>a[i]; int res=0; for(int i=n-1;i>=0;i--){ freq[a[i]]++; if(freq[a[i]-1])freq[a[i]-1]--; else res++; } cout<<res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...