제출 #935732

#제출 시각아이디문제언어결과실행 시간메모리
935732antonAdvertisement 2 (JOI23_ho_t2)C++17
100 / 100
335 ms27028 KiB
#include<bits/stdc++.h> using namespace std; #define int long long #define pii pair<int, int> void transform(pii& a){ pii b= a; a.first = b.first+b.second; a.second = b.second-b.first; } signed main(){ int n; cin>>n; vector<pii> a(n); for(int i = 0; i<n; i++){ cin>>a[i].first>>a[i].second; transform(a[i]); } sort(a.begin(), a.end()); vector<pii> st; for(int i = 0; i<n; i++){ while(st.size()>0 && st.back().second<=a[i].second){ st.pop_back(); } st.push_back(a[i]); } cout<<st.size()<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...