Submission #667982

#TimeUsernameProblemLanguageResultExecution timeMemory
667982bashkortLightning Rod (NOI18_lightningrod)C++17
14 / 100
1990 ms226928 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> x(n), y(n); for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; x[i] = a - b, y[i] = a + b; } vector<int> ord(n); iota(ord.begin(), ord.end(), 0); sort(ord.begin(), ord.end(), [&](int i, int j) { return pair{x[i], -y[i]} < pair{x[j], -y[j]}; }); int mx = 0; int ans = 0; for (int i : ord) { if (mx < y[i]) { mx = y[i]; ans += 1; } } cout << ans << '\n'; 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...