제출 #919815

#제출 시각아이디문제언어결과실행 시간메모리
919815LudisseyAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
138 ms17744 KiB
#include <bits/stdc++.h> #define int long long using namespace std; bool comp(pair<int,int> a, pair<int,int> b){ if(a.first==b.first) return a.second>b.second; return a.first<b.first; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<pair<int,int>> a(N); for (int i = 0; i < N; i++) { int x,e; cin >> x >> e; a[i]={x-e, x+e}; } sort(a.begin(), a.end(), comp); int sum=1; int r=a[0].second; for (int i = 1; i < N; i++) { if(r<a[i].second) { sum++; } r=max(a[i].second, r); } cout << sum << "\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...