Submission #200046

#TimeUsernameProblemLanguageResultExecution timeMemory
200046wilwxkLightning Rod (NOI18_lightningrod)C++14
100 / 100
1719 ms78424 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e7+7; pair<int, int> v[MAXN]; int n; int getn() { char ch = getchar_unlocked(); int ans = 0; while(!isdigit(ch)) { ch = getchar_unlocked(); } while(isdigit(ch)) { ans = ans * 10 + ch - '0'; ch = getchar_unlocked(); } return ans; } int main() { n = getn(); for(int i = 1; i <= n; i++) { int a = getn(); int b = getn(); v[i].first = a+b; v[i].second = b-a; } sort(v+1, v+1+n); int ans = 0; int mx = -(2e9+7); for(int i = n; i >= 1; i--) if(v[i].second > mx) mx = v[i].second, ans++; printf("%d\n", 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...