답안 #710870

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
710870 2023-03-16T03:14:17 Z awu Lightning Rod (NOI18_lightningrod) C++14
100 / 100
1612 ms 207680 KB
#include <bits/extc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2")

#define f first
#define s second
#define all(x) x.begin(), x.end()
#define debug(x) do{auto y = x; cout << #x << " = " << y << endl;}while(0)
// #define endl "\n"
#define unordered_map __gnu_pbds::gp_hash_table
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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1341 ms 207680 KB Output is correct
2 Correct 1348 ms 207392 KB Output is correct
3 Correct 1363 ms 205508 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 272 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 272 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 272 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 272 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 39 ms 1764 KB Output is correct
15 Correct 34 ms 1848 KB Output is correct
16 Correct 32 ms 2928 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1331 ms 144088 KB Output is correct
2 Correct 1331 ms 144032 KB Output is correct
3 Correct 1293 ms 142152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1341 ms 207680 KB Output is correct
2 Correct 1348 ms 207392 KB Output is correct
3 Correct 1363 ms 205508 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 272 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 39 ms 1764 KB Output is correct
18 Correct 34 ms 1848 KB Output is correct
19 Correct 32 ms 2928 KB Output is correct
20 Correct 1331 ms 144088 KB Output is correct
21 Correct 1331 ms 144032 KB Output is correct
22 Correct 1293 ms 142152 KB Output is correct
23 Correct 1612 ms 71316 KB Output is correct
24 Correct 1555 ms 71244 KB Output is correct
25 Correct 1490 ms 76152 KB Output is correct