제출 #861990

#제출 시각아이디문제언어결과실행 시간메모리
861990JakobZorzAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
129 ms14088 KiB
#include<iostream> #include<vector> #include<queue> #include<stack> #include<algorithm> #include<limits.h> #include<math.h> #include<map> #include<set> #include<unordered_map> #include<unordered_set> #include<iomanip> typedef long long ll; typedef long double ld; using namespace std; const int MOD=1e9+7; //typedef pair<ll,ll>Point; //typedef pair<ll,ll>Line; //#define x first //#define y second bool cmp(pair<int,int>a,pair<int,int>b){ if(a.first==b.first) return a.second>b.second; return a.first<b.first; } int main(){ ios::sync_with_stdio(false); cout.tie(NULL); cin.tie(NULL); //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); int n; cin>>n; vector<pair<int,int>>arr(n); for(auto&i:arr){ int x,a; cin>>x>>a; i={x-a,x+a}; } sort(arr.begin(),arr.end(),cmp); int cov=-2e9; int res=0; for(auto i:arr){ if(i.second>cov){ cov=i.second; res++; } } cout<<res<<"\n"; 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...