Submission #769306

#TimeUsernameProblemLanguageResultExecution timeMemory
769306tch1cherinAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
342 ms12800 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int>> p(n); for (int i = 0; i < n; i++) { int X, E; cin >> X >> E; p[i] = {E - X, E + X}; } sort(p.rbegin(), p.rend()); int ans = 0, pref = INT_MIN; for (auto [a, b] : p) { ans += b > pref; pref = max(pref, b); } 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...