제출 #736222

#제출 시각아이디문제언어결과실행 시간메모리
736222CookieAdvertisement 2 (JOI23_ho_t2)C++14
59 / 100
2078 ms2616 KiB
#include<bits/stdc++.h>
#include<fstream>
using namespace std;
ifstream fin("WINTER.inp");
ofstream fout("WINTER.out");

#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const ld PI = 3.14159265359;

const ll mod = 1e9 + 7;
const int mxn = 5e5, mxm = 1e5, sq = 400;
const int base = (1 << 18);
const ll inf = 1e9;
const ld pre = 1e-6;
int n;
pll p[mxn + 1];
bool ok[mxn + 1];
signed main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> n;
    vt<pll>p;
    forr(i, 0, n){
        int x, e; cin >> x >> e;
        p.pb({e, x});
    }
    sort(p.begin(), p.end());
    for(int i = 1; i < n; i++){
        for(int j = i - 1; j >= 0; j--){
            if(abs(p[i].se - p[j].se) <= p[i].fi - p[j].fi){
                ok[j] = 1;
            }
        }
    }
    int ans = 0;
    forr(i, 0, n){
        ans += (!ok[i]);
    }
    cout << ans;
    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...