제출 #785294

#제출 시각아이디문제언어결과실행 시간메모리
785294KLPPAdvertisement 2 (JOI23_ho_t2)C++14
100 / 100
134 ms25664 KiB
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef long long int lld; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; #define rep(i,a,b) for(int i=a;i<b;i++) #define trav(a,v) for(auto a:v) lld absol(lld x){return max(x,-x);} bool dom(pair<lld,lld> a, pair<lld,lld> b){ if(absol(a.first-b.first)<=a.second-b.second)return true; return false; } void solve(){ int n; cin>>n; vector<pair<lld,lld> >V(n); rep(i,0,n)cin>>V[i].first>>V[i].second; sort(V.begin(),V.end()); vector<pair<lld,lld> >ans; trav(a,V){ if(ans.size()==0){ ans.push_back(a); }else{ if(!dom(ans[ans.size()-1],a)){ while(ans.size()>0 && dom(a,ans[ans.size()-1]))ans.pop_back(); ans.push_back(a); } } } cout<<ans.size()<<"\n"; } int main(){ ios::sync_with_stdio(0); cin.tie(0); int tt=1; //cin>>tt; while(tt--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...