Submission #406461

#TimeUsernameProblemLanguageResultExecution timeMemory
406461FidiskLightning Rod (NOI18_lightningrod)C++14
40 / 100
2089 ms262144 KiB
#include <bits/stdc++.h> using namespace std; #define oo 1e15 #define fi first #define se second #define sp(iiii) setprecision(iiii) #define IO ios_base::sync_with_stdio(false); cin.tie(0) #define ms(aaaa,xxxx) memset(aaaa,xxxx,sizeof(aaaa)) #define cntbit(xxxx) __builtin_popcount(xxxx) #define getbit(xxxx,aaaa) ((xxxx>>(aaaa-1))&1) typedef long double ld; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; typedef pair<pair<int,int>,int> piii; typedef pair<long long,long long> pll; typedef pair<pair<long long,long long>,long long> plll; typedef pair<pair<long long,long long>,pair<long long,long long>> pllll; typedef pair<pair<long long,long long>,bool> pllb; const ll base=361; const ll mod=998244353; const ld eps=1e-5; const ll maxn=1e9+9; int n,i,last,res; pii b[10000009],a[10000009]; int main(){ IO; cin>>n; for (i=1;i<=n;i++) { cin>>a[i].fi>>a[i].se; b[i]={a[i].fi+a[i].se,a[i].fi-a[i].se}; } sort(b+1,b+n+1); last=2e9+7; for (i=n;i>=1;i--) { if (b[i].se<last) { res++; last=b[i].se; } } cout<<res<<'\n'; }
#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...