제출 #1007304

#제출 시각아이디문제언어결과실행 시간메모리
1007304THXuanAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
119 ms21016 KiB
#include <iostream> #include <vector> #include <algorithm> #include <stack> #include <queue> #include <set> #include <map> #define INF 1e9 using namespace std; typedef long long ll; void solve() { int n; cin >> n; vector<pair<ll, ll>>v; for (int i = 1; i <= n; i++) { ll x, e; cin >> x >> e; v.push_back({ e-x, e + x}); } sort(v.begin(), v.end()); stack<ll>stk; for (int i = 0; i < n; i++) { while (stk.size() && v[i].second >= stk.top()) stk.pop(); stk.push(v[i].second); } cout << stk.size() << "\n"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1;// cin>>t; while (t--) solve(); 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...