제출 #954869

#제출 시각아이디문제언어결과실행 시간메모리
954869EJIC_B_KEDAXAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
122 ms15564 KiB
#ifdef LOCAL #define _GLIBCXX_DEBUG #endif #include <bits/stdc++.h> #ifndef LOCAL #pragma GCC optimize("O3") // #pragma GCC optimize("Ofast") // #pragma GCC optimize("unroll-loops") #pragma GCC target("avx,avx2,bmi,bmi2,popcnt,lzcnt") #endif using namespace std; using ll = long long; using ld = long double; #define x first #define y second #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() mt19937_64 mt(time(0)); void solve(); void init(); int32_t main() { #ifndef LOCAL cin.tie(nullptr)->sync_with_stdio(false); #endif cout << fixed << setprecision(30); init(); int t = 1; // cin >> t; while (t--) { solve(); } } void init() {} const int N = 500500; pair<int, int> a[N]; bool check(int i, int j) { return a[i].y - a[j].y >= abs(a[i].x - a[j].x); } void solve() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i].x >> a[i].y; } sort(a, a + n); vector<int> st; for (int i = 0; i < n; i++) { while (!st.empty() && check(i, st.back())) { st.pop_back(); } if (st.empty() || !check(st.back(), i)) { st.push_back(i); } } cout << st.size() << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...