# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
672961 | 2022-12-19T08:05:13 Z | vuavisao | Lightning Rod (NOI18_lightningrod) | C++14 | 1536 ms | 262144 KB |
#include<bits/stdc++.h> #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #define ll long long using namespace std; const ll N = 1e7 + 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
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1536 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 72 ms | 156748 KB | Output is correct |
2 | Correct | 75 ms | 156824 KB | Output is correct |
3 | Correct | 92 ms | 156756 KB | Output is correct |
4 | Correct | 90 ms | 156776 KB | Output is correct |
5 | Correct | 71 ms | 156952 KB | Output is correct |
6 | Correct | 77 ms | 156996 KB | Output is correct |
7 | Correct | 74 ms | 156772 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 72 ms | 156748 KB | Output is correct |
2 | Correct | 75 ms | 156824 KB | Output is correct |
3 | Correct | 92 ms | 156756 KB | Output is correct |
4 | Correct | 90 ms | 156776 KB | Output is correct |
5 | Correct | 71 ms | 156952 KB | Output is correct |
6 | Correct | 77 ms | 156996 KB | Output is correct |
7 | Correct | 74 ms | 156772 KB | Output is correct |
8 | Correct | 74 ms | 156748 KB | Output is correct |
9 | Correct | 78 ms | 156776 KB | Output is correct |
10 | Correct | 77 ms | 156836 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 72 ms | 156748 KB | Output is correct |
2 | Correct | 75 ms | 156824 KB | Output is correct |
3 | Correct | 92 ms | 156756 KB | Output is correct |
4 | Correct | 90 ms | 156776 KB | Output is correct |
5 | Correct | 71 ms | 156952 KB | Output is correct |
6 | Correct | 77 ms | 156996 KB | Output is correct |
7 | Correct | 74 ms | 156772 KB | Output is correct |
8 | Correct | 74 ms | 156748 KB | Output is correct |
9 | Correct | 78 ms | 156776 KB | Output is correct |
10 | Correct | 77 ms | 156836 KB | Output is correct |
11 | Correct | 77 ms | 156900 KB | Output is correct |
12 | Correct | 77 ms | 156876 KB | Output is correct |
13 | Correct | 74 ms | 156892 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 72 ms | 156748 KB | Output is correct |
2 | Correct | 75 ms | 156824 KB | Output is correct |
3 | Correct | 92 ms | 156756 KB | Output is correct |
4 | Correct | 90 ms | 156776 KB | Output is correct |
5 | Correct | 71 ms | 156952 KB | Output is correct |
6 | Correct | 77 ms | 156996 KB | Output is correct |
7 | Correct | 74 ms | 156772 KB | Output is correct |
8 | Correct | 74 ms | 156748 KB | Output is correct |
9 | Correct | 78 ms | 156776 KB | Output is correct |
10 | Correct | 77 ms | 156836 KB | Output is correct |
11 | Correct | 77 ms | 156900 KB | Output is correct |
12 | Correct | 77 ms | 156876 KB | Output is correct |
13 | Correct | 74 ms | 156892 KB | Output is correct |
14 | Correct | 108 ms | 159712 KB | Output is correct |
15 | Correct | 119 ms | 159896 KB | Output is correct |
16 | Correct | 106 ms | 159744 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1438 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 1536 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |