Submission #802137

#TimeUsernameProblemLanguageResultExecution timeMemory
802137starchanAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
248 ms45652 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define in pair<int, int> #define f first #define s second #define pb push_back #define pob pop_back #define INF (int)1e17 #define MX (int)3e5+5 #define fast() ios_base::sync_with_stdio(false); cin.tie(NULL) struct janitor { set<in> ok; void add(in zz) { auto it1 = ok.lower_bound({zz.f, -INF}); if(it1 == ok.end()) { ok.insert(zz); return; } if((*it1).s >= zz.s) return; ok.insert(zz); return; } int size() { return ok.size(); } }; signed main() { fast(); int n; cin >> n; vector<in> ex(n+1); ex[0] = {INF, INF}; for(int i = 1; i <= n; i++) { cin >> ex[i].s >> ex[i].f; } sort(ex.rbegin(), ex.rend()); janitor work; for(int i = 1; i <= n; i++) work.add({ex[i].f+ex[i].s, ex[i].f-ex[i].s}); cout << work.size() << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...