Submission #917422

#TimeUsernameProblemLanguageResultExecution timeMemory
917422ting39Advertisement 2 (JOI23_ho_t2)C++17
100 / 100
349 ms18044 KiB
#include<bits/stdc++.h> #define int long long #define pii pair<int,int> #define F first #define S second using namespace std; signed main(){ int n; cin>>n; vector<pii> vp(n); for(int i=0;i<n;i++){ int a,b; cin>>a>>b; vp[i]={a-b,a+b}; } sort(vp.begin(),vp.end(),[](auto i,auto j){ if(i.F==j.F) return i.S>j.S; return i.F<j.F; }); int ans=0,mx=-1e18; for(int i=0;i<n;i++){ if(vp[i].S>mx) ans++; mx=max(mx,vp[i].S); } cout<<ans<<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...