Submission #86954

# Submission time Handle Problem Language Result Execution time Memory
86954 2018-11-28T17:47:07 Z IvanC Sunčanje (COCI18_suncanje) C++17
26 / 130
4000 ms 25704 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 2*1e5 + 10;

int N,szY,X1[MAXN],X2[MAXN],Y1[MAXN],Y2[MAXN];
bool isCovered[MAXN];

bool inter(int A,int B){
	int x_lo = max(X1[A],X1[B]);
	int x_hi = min(X2[A],X2[B]);
	if(x_lo >= x_hi) return false;
	int y_lo = max(Y1[A],Y1[B]);
	int y_hi = min(Y2[A],Y2[B]);
	if(y_lo >= y_hi) return false;
	return true;
}

int main(){

	scanf("%d",&N);
	for(int i = 1;i<=N;i++){
		int xi,yi,ai,bi;
		scanf("%d %d %d %d",&xi,&yi,&ai,&bi);
		X1[i] = xi;
		X2[i] = xi + ai;
		Y1[i] = yi;
		Y2[i] = yi + bi;
	}

	for(int i = N;i>=1;i--){
		for(int j = i+1;j<=N && !isCovered[i];j++) if(inter(i,j)) isCovered[i] = true;
	}

	for(int i = 1;i<=N;i++){
		if(isCovered[i]) printf("NE\n");
		else printf("DA\n");
	}

	return 0;

}

Compilation message

suncanje.cpp: In function 'int main()':
suncanje.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);
  ~~~~~^~~~~~~~~
suncanje.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d %d",&xi,&yi,&ai,&bi);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 42 ms 672 KB Output is correct
2 Correct 96 ms 1072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 111 ms 1476 KB Output is correct
2 Correct 3990 ms 3560 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 89 ms 3832 KB Output is correct
2 Execution timed out 4040 ms 6240 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 381 ms 6808 KB Output is correct
2 Execution timed out 4043 ms 8632 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 2124 ms 10392 KB Output is correct
2 Execution timed out 4040 ms 12340 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1564 ms 13832 KB Output is correct
2 Execution timed out 4003 ms 15496 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 4022 ms 17108 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4046 ms 19360 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4011 ms 22316 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4009 ms 25704 KB Time limit exceeded
2 Halted 0 ms 0 KB -