Submission #345038

#TimeUsernameProblemLanguageResultExecution timeMemory
345038nishuzLightning Rod (NOI18_lightningrod)C++14
40 / 100
2084 ms198636 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, ans = 0; cin >> n; vector <pair <int, int>> a(n); bool vis[n]; memset(vis, 0, sizeof vis); for (int i = 0; i < n; ++i) cin >> a[i].first >> a[i].second; sort(a.begin(), a.end(), [&](pair <int, int>& a, pair <int, int>& b) {return a.second > b.second;}); for (int i = 0; i < n; ++i) { if (vis[i]) continue; ++ans; for (int j = 0; j < n; ++j) if (abs(a[i].first - a[j].first) <= abs(a[i].second - a[j].second)) vis[j] = 1; } cout << ans << '\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...