Submission #922493

#TimeUsernameProblemLanguageResultExecution timeMemory
922493SuPythonyAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
339 ms18040 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool compare(pair<ll,ll> a, pair<ll,ll> b) { if (a.first==b.first) { return a.second>b.second; } return a.first<b.first; } int main() { int n; cin>>n; vector<pair<ll,ll>> res(n); for (int i=0; i<n; i++) { ll x,e; cin>>x>>e; res[i].first=x-e; res[i].second=x+e; } sort(res.begin(),res.end(),compare); ll max_h=0; ll ans=0; for (int i=0; i<n; i++) { if (res[i].second>max_h) { ans++; max_h=res[i].second; } } 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...