답안 #494524

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
494524 2021-12-15T16:53:36 Z blue Lightning Rod (NOI18_lightningrod) C++17
100 / 100
1889 ms 157220 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
using namespace std;

using pii = pair<int, int>;
#define sz(x) int(x.size())

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int N;
    cin >> N;

    vector<int> P;

    int x[1+N], y[1+N];

    cin >> x[1] >> y[1];

    P.push_back(1);

    for(int i = 2; i <= N; i++)
    {
        cin >> x[i] >> y[i];
        if(abs(x[i] - x[P.back()]) <= y[P.back()] - y[i]) continue;
        while(!P.empty() && abs(x[P.back()] - x[i]) <= y[i] - y[P.back()])
            P.pop_back();
        P.push_back(i);
    }

    cout << sz(P) << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1482 ms 157220 KB Output is correct
2 Correct 1463 ms 156924 KB Output is correct
3 Correct 1434 ms 154484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 308 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 308 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 308 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 50 ms 5304 KB Output is correct
15 Correct 42 ms 5132 KB Output is correct
16 Correct 39 ms 4852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1690 ms 124240 KB Output is correct
2 Correct 1522 ms 124052 KB Output is correct
3 Correct 1499 ms 122088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1482 ms 157220 KB Output is correct
2 Correct 1463 ms 156924 KB Output is correct
3 Correct 1434 ms 154484 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 308 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 50 ms 5304 KB Output is correct
18 Correct 42 ms 5132 KB Output is correct
19 Correct 39 ms 4852 KB Output is correct
20 Correct 1690 ms 124240 KB Output is correct
21 Correct 1522 ms 124052 KB Output is correct
22 Correct 1499 ms 122088 KB Output is correct
23 Correct 1889 ms 95360 KB Output is correct
24 Correct 1803 ms 90692 KB Output is correct
25 Correct 1866 ms 81740 KB Output is correct