# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
209544 | 2020-03-14T13:46:18 Z | Alexa2001 | Lightning Rod (NOI18_lightningrod) | C++17 | 794 ms | 224076 KB |
#include <bits/stdc++.h> using namespace std; const int Nmax = 1e7 + 5; int x[Nmax], y[Nmax], n; bitset<Nmax> good; const int bsize = 1<<18; char buffer[bsize+2]; int cursor; static inline void init_read() { fread(buffer, 1, bsize, stdin), cursor = 0; } void read(int &x) { x = 0; while(!isdigit(buffer[cursor])) { ++cursor; if(cursor == bsize) init_read(); } while(isdigit(buffer[cursor])) { x = x * 10 + buffer[cursor] - '0'; ++cursor; if(cursor == bsize) init_read(); } } int main() { // freopen("input", "r", stdin); init_read(); int i; int ans = 0; read(n); for(i=1; i<=n; ++i) read(x[i]), read(y[i]); int mx = INT_MIN; for(i=1; i<=n; ++i) if(x[i] + y[i] > mx) good[i] = 1, mx = x[i] + y[i]; mx = INT_MIN; for(i=n; i; --i) if(y[i] - x[i] > mx) mx = y[i] - x[i], ans += good[i]; cout << ans << '\n'; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 547 ms | 190256 KB | Output is correct |
2 | Correct | 555 ms | 189580 KB | Output is correct |
3 | Correct | 539 ms | 170340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 4 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 5 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 22 ms | 5624 KB | Output is correct |
15 | Correct | 21 ms | 5496 KB | Output is correct |
16 | Correct | 20 ms | 4856 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 533 ms | 175604 KB | Output is correct |
2 | Correct | 520 ms | 175316 KB | Output is correct |
3 | Correct | 513 ms | 170940 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 547 ms | 190256 KB | Output is correct |
2 | Correct | 555 ms | 189580 KB | Output is correct |
3 | Correct | 539 ms | 170340 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 376 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 376 KB | Output is correct |
10 | Correct | 4 ms | 376 KB | Output is correct |
11 | Correct | 5 ms | 376 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 5 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 376 KB | Output is correct |
16 | Correct | 5 ms | 376 KB | Output is correct |
17 | Correct | 22 ms | 5624 KB | Output is correct |
18 | Correct | 21 ms | 5496 KB | Output is correct |
19 | Correct | 20 ms | 4856 KB | Output is correct |
20 | Correct | 533 ms | 175604 KB | Output is correct |
21 | Correct | 520 ms | 175316 KB | Output is correct |
22 | Correct | 513 ms | 170940 KB | Output is correct |
23 | Correct | 794 ms | 224076 KB | Output is correct |
24 | Correct | 729 ms | 207748 KB | Output is correct |
25 | Correct | 694 ms | 191876 KB | Output is correct |