Submission #1270547

#TimeUsernameProblemLanguageResultExecution timeMemory
1270547goulthenAdvertisement 2 (JOI23_ho_t2)C++20
100 / 100
664 ms28320 KiB
#include <bits/stdc++.h> using namespace std; //#define int long long #define ll long long #define rep(i,a,b) for (int i = a; i <= b; i++) #define per(i,a,b) for (int i = a; i >= b; i--) #define fi first #define se second #define pii pair<int,int> #define pb push_back const int MAXN = 5e5+10; pii a[MAXN]; bool ok[MAXN]; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); int n;cin >> n; rep(i,1,n) cin >> a[i].fi >> a[i].se, ok[i] = 1; sort(a+1,a+n+1); n = unique(a+1,a+n+1)-a-1; set<int> st; rep(i,1,n) { int k = (a[i].fi + a[i].se); auto it = st.lower_bound(k); ok[i] &= (it == st.end()); st.insert(k); } st.clear(); per(i,n,1) { int k = (a[i].se-a[i].fi); auto it = st.lower_bound(k); ok[i] &= (it == st.end()); st.insert(k); } int ans = 0; rep(i,1,n) { ans+=ok[i]; } cout << ans << '\n'; 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...