답안 #91615

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91615 2018-12-28T16:39:01 Z model_code Lightning Rod (NOI18_lightningrod) C++17
100 / 100
398 ms 79856 KB
#include <bits/stdc++.h> 
using namespace std; 
stack<pair<int,int> >s; 
inline int readInt() {
    int x=0; char ch=getchar_unlocked(); bool s=1;
    while(ch<'0'||ch>'9'){if(ch=='-')s=0;ch=getchar_unlocked();}
    while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar_unlocked();}
    return s?x:-x;
}

int main(){ 
    int n = readInt(); 
    for(int i=0;i<n;i++){
        int x = readInt();
        int y = readInt();
        bool add=1; 
        while(s.size()){ 
            int tx=s.top().first,ty=s.top().second; 
            if(x-tx<=ty-y){add=0;break;} 
            if(x-tx<=y-ty)s.pop(); 
            else break; 
        } 
        if(add)s.push(make_pair(x,y)); 
    } 
    printf("%d",(int)s.size()); 
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 322 ms 79856 KB Output is correct
2 Correct 316 ms 79528 KB Output is correct
3 Correct 321 ms 77532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 10 ms 256 KB Output is correct
15 Correct 9 ms 256 KB Output is correct
16 Correct 10 ms 1016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 314 ms 51380 KB Output is correct
2 Correct 320 ms 51440 KB Output is correct
3 Correct 314 ms 50068 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 322 ms 79856 KB Output is correct
2 Correct 316 ms 79528 KB Output is correct
3 Correct 321 ms 77532 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 10 ms 256 KB Output is correct
18 Correct 9 ms 256 KB Output is correct
19 Correct 10 ms 1016 KB Output is correct
20 Correct 314 ms 51380 KB Output is correct
21 Correct 320 ms 51440 KB Output is correct
22 Correct 314 ms 50068 KB Output is correct
23 Correct 398 ms 368 KB Output is correct
24 Correct 359 ms 492 KB Output is correct
25 Correct 358 ms 3064 KB Output is correct