Submission #906301

#TimeUsernameProblemLanguageResultExecution timeMemory
906301OAleksaAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
127 ms18124 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define f first #define s second signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tt = 1; //cin >> tt; while (tt--) { int n; cin >> n; vector<pair<int, int>> a(n); for (int i = 0;i < n;i++) { int x, y; cin >> x >> y; a[i] = {x - y, x + y}; } sort(a.begin(), a.end(), [&](pair<int, int> x, pair<int, int> y) { if (x.f == y.f) return x.s > y.s; return x.f < y.f; }); int ans = 0, bst = -1; for (int i = 0;i < n;i++) { if (bst < a[i].s) { bst = a[i].s; ++ans; } } cout << ans; } 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...