제출 #745610

#제출 시각아이디문제언어결과실행 시간메모리
745610snpmrnhlolAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
438 ms11212 KiB
#include <bits/stdc++.h> using namespace std; const int N = 5e5; struct numbers{ int l,r; }; numbers v[N]; numbers pr; int main(){ int n,i,x,e,ans; cin>>n; for(i = 0;i < n;i++){ cin>>x>>e; v[i].l = x - e; v[i].r = x + e; } sort(v,v + n,[&](numbers a,numbers b){ if(a.l == b.l)return a.r > b.r; return a.l < b.l; }); ans = n; int maxx = -2e9; for(i = 0;i < n;i++){ if(pr.l == v[i].l && v[i].r == pr.r){ans--;continue;} pr = v[i]; //cout<<v[i].l<<' '<<v[i].r<<'\n'; if(maxx >= v[i].r)ans--; maxx = max(maxx,v[i].r); } 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...