Submission #667989

#TimeUsernameProblemLanguageResultExecution timeMemory
667989bashkortLightning Rod (NOI18_lightningrod)C++17
80 / 100
2078 ms78312 KiB
#include <bits/stdc++.h> using namespace std; constexpr int N = 10000000; pair<int, int> p[N]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; p[i].first = a + b, p[i].second = b - a; } sort(p, p + n); int ans = 0, mx = -1e9; for (int i = n - 1; i >= 0; --i) { ans += (mx < p[i].second && (mx = p[i].second, 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...