Submission #924114

#TimeUsernameProblemLanguageResultExecution timeMemory
924114pccLightning Rod (NOI18_lightningrod)C++14
80 / 100
2019 ms247800 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> const int mxn = 1e7+10; pii arr[mxn]; int N; int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>N; for(int i = 0;i<N;i++){ cin>>arr[i].fs>>arr[i].sc; arr[i] = make_pair(arr[i].fs-arr[i].sc,arr[i].fs+arr[i].sc); } sort(arr,arr+N,[](pii &a,pii &b){return a.fs == b.fs?a.sc>b.sc:a.fs<b.fs;}); int ans = 0,big = INT_MIN; for(int i = 0;i<N;i++){ //cout<<arr[i].fs<<','<<arr[i].sc<<' '; ans += (big<arr[i].sc); big = max(big,arr[i].sc); } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...