Submission #743160

#TimeUsernameProblemLanguageResultExecution timeMemory
743160vjudge1Lightning Rod (NOI18_lightningrod)C++17
40 / 100
2091 ms205192 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; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,ans=0; cin >> n; for(int i=1;i<=n;i++) cin >> arr[i].x >> arr[i].y; if (n>2000) { set<int> s; for(int i=1;i<=n;i++) { s.insert(arr[i].x); } cout << s.size(); return 0; } 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...