답안 #742954

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
742954 2023-05-17T06:52:24 Z vjudge1 Lightning Rod (NOI18_lightningrod) C++17
100 / 100
1648 ms 82288 KB
#include <bits/stdc++.h>
using namespace std;
using pi = pair<int,int>;

int xl,yl,x,y;
int ans=0,n;
stack<pi> s;
bool v=true;

int main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> x >> y;
        if(s.empty()){s.push({x,y});}
        v=true;
        while(true){
            if(s.empty())break;
            auto[xl,yl]=s.top();
            if(x-xl <= yl-y){//negative gradient = nom'd
                v=false;
                break;
            }
            if(x-xl <= y-yl){
                s.pop();
            }else{
                break;
            }
        }
        if(v)s.push({x,y});
    }
    cout << s.size();
    return 0;
}
/*
3
0 0
1 1
2 3
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1410 ms 82288 KB Output is correct
2 Correct 1382 ms 81884 KB Output is correct
3 Correct 1338 ms 79564 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 2 ms 212 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 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 2 ms 212 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 320 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 324 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 2 ms 212 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 320 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 324 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 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 2 ms 212 KB Output is correct
4 Correct 1 ms 328 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 320 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 324 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 36 ms 960 KB Output is correct
15 Correct 38 ms 948 KB Output is correct
16 Correct 33 ms 1612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1404 ms 52876 KB Output is correct
2 Correct 1391 ms 53252 KB Output is correct
3 Correct 1381 ms 51836 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1410 ms 82288 KB Output is correct
2 Correct 1382 ms 81884 KB Output is correct
3 Correct 1338 ms 79564 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 1 ms 328 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 320 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 212 KB Output is correct
13 Correct 1 ms 324 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 36 ms 960 KB Output is correct
18 Correct 38 ms 948 KB Output is correct
19 Correct 33 ms 1612 KB Output is correct
20 Correct 1404 ms 52876 KB Output is correct
21 Correct 1391 ms 53252 KB Output is correct
22 Correct 1381 ms 51836 KB Output is correct
23 Correct 1648 ms 2580 KB Output is correct
24 Correct 1585 ms 1912 KB Output is correct
25 Correct 1596 ms 4504 KB Output is correct