Submission #131264

# Submission time Handle Problem Language Result Execution time Memory
131264 2019-07-16T21:49:50 Z FedericoS Lightning Rod (NOI18_lightningrod) C++14
66 / 100
2000 ms 152964 KB
#include <iostream>
#include <algorithm>
using namespace std;

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

bool comp(int a, int b){
	return Y[a]>Y[b];
}

int main(){
	scanf("%d", &N);
	for(int i=0;i<N;i++)
		scanf("%d %d", &X[i], &Y[i]);

	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];

	printf("%d\n", ans);


}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
lightningrod.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &X[i], &Y[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 2058 ms 152964 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 2 ms 400 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
# Verdict Execution time Memory 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 2 ms 400 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
# Verdict Execution time Memory 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 2 ms 400 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 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
# Verdict Execution time Memory 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 2 ms 400 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 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 66 ms 3880 KB Output is correct
15 Correct 62 ms 3704 KB Output is correct
16 Correct 57 ms 3680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2037 ms 149680 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2058 ms 152964 KB Time limit exceeded
2 Halted 0 ms 0 KB -