# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
672960 | vuavisao | Lightning Rod (NOI18_lightningrod) | C++14 | 42 ms | 9832 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define ll long long
using namespace std;
const ll N = 2e5 + 10;
const ll INF = 1e18;
struct Point {
ll x = 0, y = 0;
Point() {};
Point(ll _x, ll _y) { x = _x; y = _y; };
};
ll n;
Point p[N];
ll pred[N], suf[N];
ll res;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if (fopen("NOI18_lightningrod.inp", "r")) {
freopen("NOI18_lightningrod.inp", "r", stdin);
freopen("NOI18_lightningrod.out", "w", stdout);
}
cin >> n;
for(ll i = 1; i <= n; ++ i) {
ll x, y; cin >> x >> y;
p[i] = Point(x + y, x - y);
}
pred[0] = - INF;
for(ll i = 1; i <= n; ++ i) {
pred[i] = max(pred[i - 1], p[i].x);
}
suf[n + 1] = INF;
for(ll i = n; i >= 1; -- i) {
suf[i] = min(suf[i + 1], p[i].y);
}
for(int i = 1; i <= n; ++ i) {
bool have_left = (pred[i] > pred[i - 1]);
bool have_right = (suf[i] < suf[i + 1]);
res += (have_left & have_right);
}
cout << res;
return 0;
}
/// Code by vuavisao
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |