답안 #423875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
423875 2021-06-11T13:39:00 Z faresbasbs Lightning Rod (NOI18_lightningrod) C++14
100 / 100
633 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
inline int readInt() {
    int x = 0;
    char ch = getchar_unlocked();
    while (ch < '0' || ch > '9') ch = getchar_unlocked();
    while (ch >= '0' && ch <= '9'){
		x = (x << 3) + (x << 1) + ch - '0';
		ch = getchar_unlocked();
	}
    return x;
}

int X[10000000], Y[10000000];

int main(){
	int N = readInt();
	stack<pair<int,int>> st;
	for(int i = 0; i < N; i++) {
		X[i] = readInt();
		Y[i] = readInt();
		while(true){
			if(st.size() && X[i]-st.top().first <= Y[i]-st.top().second){
				st.pop();
			}else if(st.size() && st.top().first-X[i] >= Y[i]-st.top().second){
				break;
			}else{
				st.push({X[i],Y[i]});
				break;
			}
		}
	}
	cout << st.size() << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 401 ms 262144 KB Output is correct
2 Correct 408 ms 262144 KB Output is correct
3 Correct 385 ms 260168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 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 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 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 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 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 204 KB Output is correct
10 Correct 0 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 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 304 KB Output is correct
5 Correct 1 ms 300 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 204 KB Output is correct
10 Correct 0 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 12 ms 5324 KB Output is correct
15 Correct 11 ms 5076 KB Output is correct
16 Correct 11 ms 5196 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 390 ms 225108 KB Output is correct
2 Correct 425 ms 219488 KB Output is correct
3 Correct 419 ms 210524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 401 ms 262144 KB Output is correct
2 Correct 408 ms 262144 KB Output is correct
3 Correct 385 ms 260168 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 1 ms 300 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 204 KB Output is correct
13 Correct 0 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 12 ms 5324 KB Output is correct
18 Correct 11 ms 5076 KB Output is correct
19 Correct 11 ms 5196 KB Output is correct
20 Correct 390 ms 225108 KB Output is correct
21 Correct 425 ms 219488 KB Output is correct
22 Correct 419 ms 210524 KB Output is correct
23 Correct 633 ms 224404 KB Output is correct
24 Correct 608 ms 207440 KB Output is correct
25 Correct 518 ms 203880 KB Output is correct