Submission #858479

#TimeUsernameProblemLanguageResultExecution timeMemory
858479ily2003Baloni (COCI15_baloni)C++14
100 / 100
43 ms7508 KiB
#include <bits/stdc++.h> using namespace std; int n,ans,a[1000001],dp[1000001]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i=1;i<=n;++i) cin >> a[i]; for (int i=1;i<=n;++i) { if (dp[a[i]]==0) ++ans,++dp[a[i]]; --dp[a[i]]; ++dp[a[i]-1]; } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...