Submission #710853

#TimeUsernameProblemLanguageResultExecution timeMemory
710853awuLightning Rod (NOI18_lightningrod)C++14
80 / 100
2104 ms156752 KiB
#include <bits/extc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2") #define int long long #define f first #define s second #define all(x) x.begin(), x.end() #define debug(x) do{auto y = x; cout << #x << " = " << y << endl;}while(0) // #define endl "\n" #define unordered_map __gnu_pbds::gp_hash_table using pii = pair<int, int>; const int inf = 1ll << 60; const int MOD = 1e9 + 7; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<pii> pts(n); #pragma GCC ivdep for(int i = 0; i < n; i++) { int x, y; cin >> x >> y; pts[i] = {x - y, -(x + y)}; } sort(all(pts)); int hi = -inf; int ans = 0; for(auto p : pts) { p.s *= -1; if(p.s > hi) { hi = p.s; ans++; } } 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...