Submission #853041

#TimeUsernameProblemLanguageResultExecution timeMemory
853041vjudge1Baloni (COCI15_baloni)C++17
100 / 100
44 ms7760 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; const int MX = 1e6+5; void solve() { int N; cin >> N; vector<int> cnt(MX); int ans = 0; for(int i = 0; i < N; i++) { int x; cin >> x; if(cnt[x] == 0) { ans++; cnt[x]++; } cnt[x]--; cnt[x-1]++; } cout << ans << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; while(t--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...