Submission #162697

#TimeUsernameProblemLanguageResultExecution timeMemory
162697Leonardo_PaesBaloni (COCI15_baloni)C++17
0 / 100
88 ms7288 KiB
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6+10; bitset<maxn> mark; int h[maxn]; int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int n, ans=0; cin >> n; for(int i=1; i<=n; i++) cin >> h[i]; for(int i=n; i>=1; i--){ if(mark[h[i]-1]){ mark[h[i]-1] = false; } else{ ans++; } mark[h[i]] = true; } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...