제출 #1093091

#제출 시각아이디문제언어결과실행 시간메모리
1093091AbitoAdvertisement 2 (JOI23_ho_t2)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define F first #define S second #define pb push_back #define ppb pop_back #define ep insert #define endl '\n' #define elif else if #define pow pwr #define sqrt sqrtt #define int long long #define ll long long typedef unsigned long long ull; using namespace std; const int N=5e5+5; pair<int,int> a[N]; int n; bool b[N]; int32_t main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); cin>>n; for (int i=1;i<=n;i++) cin>>a[i].F>>a[i].S; sort(a+1,a+1+n); int mx=LLONG_MIN; for (int i=1;i<=n;i++){ if (a[i].F+a[i].S<=mx) b[i]=1; mx=max(mx,a[i].S+a[i].F); } mx=LLONG_MIN; for (int i=n;i;i--){ if (a[i].S-a[i].F<=mx) b[i]=1; mx=max(mx,a[i].S-a[i].F); } int ans=0; for (int i=1;i<=n;i++) if (!b[i]) ans++; cout<<ans<<endl; 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...