Submission #1136750

#TimeUsernameProblemLanguageResultExecution timeMemory
1136750nuutsnoyntonAdvertisement 2 (JOI23_ho_t2)C++20
100 / 100
276 ms8760 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; using pll = pair <ll, ll >; bool cmp(pll A, pll B) { if ( A.first == B.first) return A.second < B.second; return A.first > B.first; } int main() { ll r, x, y, i, X,mx, Y, can, lo, hi, mid, n, j, ans, t, e; cin >> n; vector < pair < ll, ll > > vp; for (i = 1; i<= n; i ++) { cin >> x >> y; vp.push_back({x - y, x + y}); } stack < pll > S; sort(vp.rbegin(), vp.rend(), cmp); mx = -1e9 -1; ans = 0; for (i =0; i < vp.size(); i ++) { if ( vp[i].second > mx) { mx = vp[i].second; ans ++; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...