Submission #668598

#TimeUsernameProblemLanguageResultExecution timeMemory
668598600MihneaLightning Rod (NOI18_lightningrod)C++17
80 / 100
2062 ms148828 KiB
#include <bits/stdc++.h> using namespace std; struct T { int x; int y; }; bool good(T a, T b) { return a.x <= b.x && a.y <= b.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 ///gen(); cin >> n; for (int i = 1; i <= n; i++) { int x, y; cin >> v[i].x >> v[i].y; x = -(v[i].x + v[i].y); y = (v[i].x - v[i].y); v[i].x = x; v[i].y = 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...