제출 #873051

#제출 시각아이디문제언어결과실행 시간메모리
873051PagodePaivaAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
348 ms14284 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector <pair <int, int>> v; for(int i = 0;i < n;i++){ int a, b; cin >> a >> b; v.push_back({b-a, a+b}); } sort(v.begin(), v.end()); reverse(v.begin(), v.end()); int res = 1; int mx = v[0].second; for(int i = 1;i < n;i++){ if(v[i].second <= mx) continue; res++; mx = v[i].second; } cout << res << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...