#include <bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
typedef pair<int, int> pii ;
typedef pair<int, long long> pil ;
typedef pair<long long, int> pli ;
typedef pair<long long, long long> pll ;
#define bitc(n) (__builtin_popcountll(n))
#define clz(n) (__builtin_clzll(n))
#define ctz(n) (__builtin_ctzll(n))
#define lgi(n) (31 - __builtin_clz(n))
#define lgl(n) (63 - __builtin_clzll(n))
#define MASK(k) (1ll << (k))
#define getbit(n, k) ((n) >> (k) & 1)
#define flipbit(n, k) ((n) ^ (1ll << (k)))
#define ton(n, k) ((n) | (1ll << (k)))
#define toff(n, k) ((n) & ~(1ll << (k)))
#define fi first
#define se second
#define mp make_pair
#define eb emplace_back
#define lwb lower_bound
#define upb upper_bound
#define sz(x) (int)(x.size())
#define all(x) x.begin(),x.end()
#define taskname "input"
template<class X, class Y>
bool maximize(X &x, const Y &y) {
if(x < y) {
return x = y, true ;
}
return false ;
}
template<class X, class Y>
bool minimize(X &x, const Y &y) {
if(x > y) {
return x = y, true ;
}
return false ;
}
template<class X>
void removeDup(vector<X> &ve) {
sort(ve.begin(), ve.end()) ;
ve.resize(unique(ve.begin(), ve.end()) - ve.begin()) ;
}
const ll INF = 1e18 ;
const int inf = 1e9 ;
const int mod = 1e9 + 7 ;
const int N = 1e5 + 5, LG = 17 ;
/* Some Peach Tea Is Great ;-; */
/* Author : Tuandq */
int n ;
vector<pii> lst ;
void kittncool() {
cin >> n ;
for(int i = 1; i <= n; i ++) {
int x, e ; cin >> x >> e ;
lst.emplace_back(x, e) ;
}
removeDup(lst) ;
sort(all(lst), [&](auto u, auto v) {
return u.fi > v.fi ;
}) ;
int res = 0 ;
ll add = INF, sub = INF ;
for(auto [x, e] : lst) {
if(minimize(add, 1ll * e + x) && minimize(sub, 1ll * e - x)) ++ res ;
}
cout << res ;
}
signed main() {
ios_base::sync_with_stdio(0) ; cin.tie(0) ; cout.tie(0) ;
if(fopen(taskname".inp", "r")) {
freopen(taskname".inp", "r", stdin) ;
freopen(taskname".out", "w", stdout) ;
}
int t = 1 ; //cin >> t ;
while(t --) {
kittncool() ;
}
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int main()':
Main.cpp:88:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
88 | freopen(taskname".inp", "r", stdin) ;
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:89:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
89 | freopen(taskname".out", "w", stdout) ;
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |