Submission #668599

#TimeUsernameProblemLanguageResultExecution timeMemory
668599600MihneaLightning Rod (NOI18_lightningrod)C++17
80 / 100
2061 ms79504 KiB
#include <bits/stdc++.h> using namespace std; struct T { int x; int y; }; bool operator < (T& a, T& b) { if (a.y == b.y) { return a.x < b.x; } return a.y < b.y; } const int N = 10000000 + 7; int n; T v[N]; int dp[N]; signed main() { #ifdef ONPC freopen ("input.txt", "r", stdin); #endif // ONPC #ifndef ONPC ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #endif // ONPC cin >> n; for (int i = 1; i <= n; i++) { int x, y; cin >> x >> y; v[i] = {-x - y, x - y}; } sort(v + 1, v + n + 1); int mn = v[1].x, cnt = 1; for (int i = 2; i <= n; i++) { if (v[i].x < mn) { mn = v[i].x; cnt++; } } cout << cnt << "\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...