제출 #936984

#제출 시각아이디문제언어결과실행 시간메모리
936984tianyaochiunAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
131 ms27340 KiB
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #define ll long long #define pii pair<long long,long long> #define F first #define S second #define pb emplace_back #define endl "\n" #define all(a) a.begin(),a.end() #define int long long void solve(){ int n; cin>>n; vector<pii> a(n); for(int i=0;i<n;i++){ cin>>a[i].F>>a[i].S; } sort(all(a)); vector<pii> stk; for(int i=0;i<n;i++){ if(stk.size()&&stk.back().F+stk.back().S-a[i].S>=a[i].F) continue; while(stk.size()&&a[i].F-a[i].S+stk.back().S<=stk.back().F) stk.pop_back(); stk.pb(a[i]); } cout<<(int)stk.size(); } signed 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...