Submission #988833

#TimeUsernameProblemLanguageResultExecution timeMemory
988833HienTDAdvertisement 2 (JOI23_ho_t2)C++11
100 / 100
122 ms13680 KiB
#include <bits/stdc++.h> #define int long long #define rep(i, l, r) for(int i = l; i <= r; i ++) #define fi first #define se second #define endl '\n' using namespace std; typedef pair<int, int> pii; bool cmp(pii a, pii b){ if(a.first != b.first) return a.first < b.first; return a.second > b.second; } void solve(){ int N; cin >> N; vector<pii> point; rep(i, 1, N){ int X, E; cin >> X >> E; point.push_back({X - E, X + E}); } sort(point.begin(), point.end(), cmp); int ma = -1; int cnt = 0; for(pii p : point){ if(ma < p.second){ ma = p.second; cnt ++; } } cout << cnt; } signed main(){ ios::sync_with_stdio(0); cin.tie(0); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...