제출 #1022985

#제출 시각아이디문제언어결과실행 시간메모리
1022985ag_1204Advertisement 2 (JOI23_ho_t2)C++14
100 / 100
133 ms24800 KiB
#include<bits/stdc++.h> using namespace std; #define int long long int #define pii pair<int,int> #define vi vector<int> #define si set<int> #define pb push_back int32_t main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; pii arr[n]; for (int i=0;i<n;i++) { int a, b; cin >> a >> b; arr[i] = {b - a, b + a}; } sort(arr,arr+n); stack<pii> s; for (int i=0;i<n;i++) { auto cur = arr[i]; while (s.size() && s.top().first <= arr[i].first && s.top().second <= arr[i].second) { s.pop(); } s.push(cur); } cout << s.size(); 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...