Submission #743092

#TimeUsernameProblemLanguageResultExecution timeMemory
743092vjudge1Lightning Rod (NOI18_lightningrod)C++17
40 / 100
2077 ms96820 KiB
#include <bits/stdc++.h> #define x first #define y second using namespace std; const int N = 1e7 + 1; pair<int,int> arr[N]; map<pair<int,int>, bool> mp; bool comp(const pair<int,int> &a, const pair<int,int> &b) { if (a.second != b.second) return a.second > b.second; return a.first > b.first; } inline void read(int &x) { x = 0; char ch = getchar_unlocked(); while (ch & 16) { x = (x << 3) + (x << 1) + (ch & 15); ch = getchar_unlocked(); } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,ans=0; read(n); for(int i=1;i<=n;i++) { read(arr[i].x); read(arr[i].y); } sort(arr+1, arr+1+n, comp); for(int i=1;i<=n;i++) { bool check = false; for(auto [a,b]:mp) { if (abs(arr[i].x - a.x) <= abs(arr[i].y - a.y)) check = true; } if (!check) { ans++; mp[arr[i]] = true; } } cout << ans; return 0; }
#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...