제출 #146995

#제출 시각아이디문제언어결과실행 시간메모리
146995jun6873Lightning Rod (NOI18_lightningrod)C++11
66 / 100
2071 ms156248 KiB
#include <bits/stdc++.h> using namespace std; using lint = long long; using pint = pair<lint, lint>; #define x first #define y second const int maxn = 10000004; int n, k, b[maxn]; pint a[maxn]; int ccw(pint a, pint b, pint c) { lint k = a.x*b.y + b.x*c.y + c.x*a.y - b.x*a.y - c.x*b.y - a.x*c.y; if (k>0) return 1; if (k<0) return -1; return 0; } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i=0; i<n; i++) { int x, y; cin >> x >> y; a[i] = pint(x+y, y-x); } sort(a, a+n); reverse(a, a+n); n = unique(a, a+n, [](pint x, pint y) { return x.x == y.x; }) - a; reverse(a, a+n); for (int i=0; i<n; i++) { while (k and b[k-1] <= a[i].y) k--; b[k++] = a[i].y; } cout << k << '\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...