Submission #994702

#TimeUsernameProblemLanguageResultExecution timeMemory
994702zhehanAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
317 ms13932 KiB
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<pair<int, int>> points(N); for (int i = 0; i < N; i++) { int X, E; cin >> X >> E; points[i] = {X - E, X + E}; } sort(points.begin(), points.end(), [] (auto &i, auto &j) { if (i.first != j.first) return i.first < j.first; return i.second > j.second; }); int maxi = -1; int count = 0; for (auto i : points) { if (maxi < i.second) { maxi = i.second; count++; } } cout << count << endl; 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...