Submission #710869

# Submission time Handle Problem Language Result Execution time Memory
710869 2023-03-16T03:13:17 Z awu Lightning Rod (NOI18_lightningrod) C++14
100 / 100
1732 ms 209964 KB
#include <bits/extc++.h>
using namespace std;
#define f first
#define s second
#define all(x) x.begin(), x.end()
using pii = pair<int, int>;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n; cin >> n;
  vector<pii> pts(n);
  for(int i = 0; i < n; i++) {
    int x, y; cin >> x >> y;
    pts[i] = {x, y};
  }
  vector<pii> stac;
  for(auto p : pts) {
#define sb stac.back()
    while(stac.size() && p.s - p.f >= sb.s - sb.f) {
      stac.pop_back();
    }
    if(!stac.size() || p.f + p.s > sb.f + sb.s) {
      stac.push_back(p);
    }
  }
  cout << stac.size() << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1383 ms 208224 KB Output is correct
2 Correct 1477 ms 209964 KB Output is correct
3 Correct 1412 ms 207060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 276 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 276 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 276 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 40 ms 1864 KB Output is correct
15 Correct 37 ms 1880 KB Output is correct
16 Correct 34 ms 2960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1461 ms 146004 KB Output is correct
2 Correct 1498 ms 147044 KB Output is correct
3 Correct 1463 ms 146648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1383 ms 208224 KB Output is correct
2 Correct 1477 ms 209964 KB Output is correct
3 Correct 1412 ms 207060 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 276 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 40 ms 1864 KB Output is correct
18 Correct 37 ms 1880 KB Output is correct
19 Correct 34 ms 2960 KB Output is correct
20 Correct 1461 ms 146004 KB Output is correct
21 Correct 1498 ms 147044 KB Output is correct
22 Correct 1463 ms 146648 KB Output is correct
23 Correct 1712 ms 79260 KB Output is correct
24 Correct 1732 ms 183980 KB Output is correct
25 Correct 1646 ms 173276 KB Output is correct