답안 #131267

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
131267 2019-07-16T21:58:24 Z FedericoS Lightning Rod (NOI18_lightningrod) C++14
100 / 100
740 ms 254816 KB
#include <iostream>
#include <algorithm>
using namespace std;

int N;
int X[10000007];
int Y[10000007];
bool B[10000007];
int ans,a;

int readInt(){
    int res = 0;
    char ch = 0;
    while(ch < '0') ch = getchar_unlocked();
    for(; ch >= '0'; ch = getchar_unlocked()) res = res * 10 + ch - '0';
    return res;
}

void writeInt(int v){
    char buf[14];
    int p = 0;
    if(v == 0) buf[p++] = 0;
    for(; v; v /= 10) buf[p++] = v % 10;
    while(p--) putchar_unlocked(buf[p] + '0');
}

int main(){

	N=readInt();
	for(int i=0;i<N;i++){
		X[i]=readInt();
		Y[i]=readInt();
	}

	a=-2e9-5;	
	for(int i=0;i<N;i++){
		if(a<X[i]+Y[i])
			a=X[i]+Y[i];
		else
			B[i]=true;
	}

	a=-2e9-5;
	for(int i=N-1;i>=0;i--){
		if(a<-X[i]+Y[i])
			a=-X[i]+Y[i];
		else
			B[i]=true;
	}

	for(int i=0;i<N;i++)
		ans+=!B[i];

	writeInt(ans);

}
# 결과 실행 시간 메모리 Grader output
1 Correct 465 ms 76456 KB Output is correct
2 Correct 486 ms 188160 KB Output is correct
3 Correct 488 ms 183044 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 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 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 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 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 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 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 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 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 17 ms 4856 KB Output is correct
15 Correct 19 ms 4988 KB Output is correct
16 Correct 17 ms 4472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 477 ms 89896 KB Output is correct
2 Correct 520 ms 184072 KB Output is correct
3 Correct 529 ms 179660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 465 ms 76456 KB Output is correct
2 Correct 486 ms 188160 KB Output is correct
3 Correct 488 ms 183044 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 380 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 17 ms 4856 KB Output is correct
18 Correct 19 ms 4988 KB Output is correct
19 Correct 17 ms 4472 KB Output is correct
20 Correct 477 ms 89896 KB Output is correct
21 Correct 520 ms 184072 KB Output is correct
22 Correct 529 ms 179660 KB Output is correct
23 Correct 740 ms 254816 KB Output is correct
24 Correct 673 ms 236276 KB Output is correct
25 Correct 651 ms 217428 KB Output is correct