제출 #999142

#제출 시각아이디문제언어결과실행 시간메모리
999142ZeroCoolAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
161 ms17968 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ll long long #define ar array #define ld long double const int N = 2000, MOD = 1e9 + 7, INF = 1e17; signed main(){ios::sync_with_stdio(false);cin.tie(0); int n; cin>>n; ar<int, 2> A[n]; for(int i = 0;i<n;i++){ int x, e; cin>>x>>e; A[i] = {x - e, x + e}; } sort(A, A+n, [](auto a,auto b){ return a[0] < b[0] || (a[0] == b[0] && a[1] > b[1]); }); int ans = 0; int x = 0; for(int i = 0;i<n;i++){ if(A[i][1] > x){ ans++; x = A[i][1]; } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...