제출 #924132

#제출 시각아이디문제언어결과실행 시간메모리
924132ErJAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
123 ms16212 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<ll> #define vvi vector<vector<ll>> #define vs vector<string> #define vc vector<char> #define vb vector<bool> #define vp vector<pair<ll, ll>> #define pp pair<ll, ll> #define qi queue<ll> #define qp queue<pp> #define pqi priority_queue<ll> #define pqp priority_queue<pp> #define mi map<ll, ll> #define mpi map<pp, ll> #define mip map<ll, pp> #define mpp map<pp, pp> #define mb map<ll, bool> #define si set<ll> #define sp set<pp> #define mod 1000000007 #define rep(a, b) for(int a = 0; a < (b); a++) #define inf 100000000111111111 int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vi X(n), E(n); vp C(n); rep(i, n) { cin >> X[i] >> E[i]; C[i] = { X[i] - E[i], X[i] + E[i] }; } sort(C.begin(), C.end(), [](auto& i, auto& j) { if (i.first != j.first) return i.first < j.first; return i.second > j.second; }); ll MAXB = -1; ll ans = 0; rep(i, n) { if (C[i].second > MAXB) { ans++; MAXB = C[i].second; } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...