Submission #206230

#TimeUsernameProblemLanguageResultExecution timeMemory
206230Haunted_CppBaloni (COCI15_baloni)C++17
100 / 100
368 ms4344 KiB
#include <iostream> #include <vector> #include <map> #include <cassert> #include <set> #include <algorithm> #define FOR(i, a, b) for(int i = a; i < (int) b; i++) #define F0R(i, a) FOR (i, 0, a) #define ROF(i, a, b) for(int i = a; i >= (int) b; i--) #define R0F(i, a) ROF(i, a, 0) #define GO(i, a) for (auto i : a) #define eb emplace_back #define sz(x) (int) x.size() #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define f first #define s second using namespace std; typedef long long i64; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vpii; typedef vector<vi> vvi; typedef vector<vpii> vvpii; typedef vector<i64> vi64; const int dr[] = {+1, -1, +0, +0, +1, -1, -1, +1}; const int dc[] = {+0, +0, +1, -1, +1, -1, +1, -1}; /* const int dc[] = {+2, +2, -2, -2, +1, -1, +1, -1}; const int dr[] = {+1, -1, +1, -1, +2, +2, -2, -2}; */ //const int m[] = {+31, +29, +31, +30, +31, +30, +31, +31, +30, +31, +30, +31}; multiset<int> can_remove; int main() { ios::sync_with_stdio(0); cin.tie(0); int res = 0; int n; cin >> n; F0R (i, n) { int foo; cin >> foo; if (can_remove.find(foo) != can_remove.end()) { can_remove.erase(can_remove.lower_bound(foo)); } else { ++res; } can_remove.insert(foo - 1); } cout << res << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...