제출 #848170

#제출 시각아이디문제언어결과실행 시간메모리
848170thangdz2k7Advertisement 2 (JOI23_ho_t2)C++17
100 / 100
116 ms9636 KiB
#include <bits/stdc++.h> #define ii pair <int, int> #define F first #define S second using namespace std; const int mod = 1e9 + 7; const int N = 5e5 + 5; int n; ii sr[N]; void solve(){ cin >> n; for (int i = 1, x, e; i <= n; ++ i){ cin >> x >> e; sr[i].F = e - x; sr[i].S = e + x; } sort(sr + 1, sr + n + 1); int Max = -2e9; int ans = 0; for (int i = n; i >= 1; -- i){ if (Max < sr[i].S){ ++ ans; Max = sr[i].S; } } cout << ans; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; while (t --) solve(); 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...