Submission #997943

#TimeUsernameProblemLanguageResultExecution timeMemory
997943yanbAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
113 ms33648 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<long long, long long> signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> t(n), e(n), x(n), y(n); for (int i = 0; i < n; i++) cin >> t[i] >> e[i]; vector<pii> xy(n); for (int i = 0; i < n; i++) xy[i] = {t[i] - e[i], - t[i] - e[i]}; sort(xy.begin(), xy.end()); for (int i = 0; i < n; i++) { x[i] = xy[i].first; y[i] = -xy[i].second; } int h = -1e17, ans = 0; for (int i = 0; i < n; i++) { if (y[i] > h) ans++; h = max(h, y[i]); } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...