Submission #654269

#TimeUsernameProblemLanguageResultExecution timeMemory
654269HanksburgerBaloni (COCI15_baloni)C++17
100 / 100
210 ms3932 KiB
#include <bits/stdc++.h> using namespace std; multiset<int> s; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, cnt=0; cin >> n; for (int i=1; i<=n; i++) { int x; cin >> x; auto itr=s.lower_bound(x); if (itr!=s.end() && (*itr)==x) s.erase(itr); else cnt++; s.insert(x-1); } cout << cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...