Submission #63168

# Submission time Handle Problem Language Result Execution time Memory
63168 2018-08-01T01:50:11 Z kjp4155 None (KOI18_box) C++17
100 / 100
4 ms 636 KB
#include <stdio.h>
#include <algorithm>
using namespace std;

int main(){
	int px1, py1, px2, py2;
	int qx1, qy1, qx2, qy2;
	scanf("%d%d%d%d",&px1,&py1,&px2,&py2);
	scanf("%d%d%d%d",&qx1,&qy1,&qx2,&qy2);

	// 두 사각형 P,Q의 교집합이 되는 직사각형을 구하자 
	int x_left = max(px1, qx1); // 교집합의 좌변
	int x_right = min(px2, qx2); // 교집합의 우변
	int y_bottom = max(py1, qy1); // 교집합의 윗변
	int y_top = min(py2, qy2); // 교집합의 아랫변

	// 교집합 직사각형의 가로, 세로길이
	int xdiff = x_right - x_left;
	int ydiff = y_top - y_bottom;

	// 교집합의 가로길이, 세로길이 모두 양수인 경우 FACE
	if( xdiff > 0 && ydiff > 0 ) printf("FACE\n");
	// 교집합의 가로길이 혹은 세로길이 중 하나만 0이고 나머지가 양수인 경우 LINE
	else if( xdiff == 0 && ydiff > 0 ) printf("LINE\n");
	else if( xdiff > 0 && ydiff == 0 ) printf("LINE\n");
	// 교집합의 가로길이, 세로길이 모두 0인 경우 POINT 
	else if( xdiff == 0 && ydiff == 0 ) printf("POINT\n");
	// 이외의 경우 NULL
	else printf("NULL\n");
}

Compilation message

box.cpp: In function 'int main()':
box.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d",&px1,&py1,&px2,&py2);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
box.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d",&qx1,&qy1,&qx2,&qy2);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 432 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 540 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 3 ms 544 KB Output is correct
9 Correct 2 ms 544 KB Output is correct
10 Correct 3 ms 544 KB Output is correct
11 Correct 2 ms 544 KB Output is correct
12 Correct 3 ms 544 KB Output is correct
13 Correct 3 ms 544 KB Output is correct
14 Correct 2 ms 544 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 544 KB Output is correct
2 Correct 3 ms 544 KB Output is correct
3 Correct 2 ms 544 KB Output is correct
4 Correct 2 ms 544 KB Output is correct
5 Correct 2 ms 544 KB Output is correct
6 Correct 2 ms 544 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 3 ms 544 KB Output is correct
9 Correct 3 ms 544 KB Output is correct
10 Correct 3 ms 544 KB Output is correct
11 Correct 3 ms 544 KB Output is correct
12 Correct 2 ms 544 KB Output is correct
13 Correct 2 ms 544 KB Output is correct
14 Correct 3 ms 544 KB Output is correct
15 Correct 3 ms 628 KB Output is correct
16 Correct 3 ms 628 KB Output is correct
17 Correct 2 ms 628 KB Output is correct
18 Correct 3 ms 628 KB Output is correct
19 Correct 2 ms 628 KB Output is correct
20 Correct 3 ms 628 KB Output is correct
21 Correct 3 ms 636 KB Output is correct
22 Correct 1 ms 636 KB Output is correct
23 Correct 3 ms 636 KB Output is correct
24 Correct 3 ms 636 KB Output is correct
25 Correct 1 ms 636 KB Output is correct
26 Correct 3 ms 636 KB Output is correct
27 Correct 3 ms 636 KB Output is correct
28 Correct 2 ms 636 KB Output is correct
29 Correct 3 ms 636 KB Output is correct
30 Correct 3 ms 636 KB Output is correct
31 Correct 4 ms 636 KB Output is correct
32 Correct 3 ms 636 KB Output is correct
33 Correct 3 ms 636 KB Output is correct
34 Correct 2 ms 636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 432 KB Output is correct
5 Correct 2 ms 508 KB Output is correct
6 Correct 2 ms 540 KB Output is correct
7 Correct 2 ms 544 KB Output is correct
8 Correct 3 ms 544 KB Output is correct
9 Correct 2 ms 544 KB Output is correct
10 Correct 3 ms 544 KB Output is correct
11 Correct 2 ms 544 KB Output is correct
12 Correct 3 ms 544 KB Output is correct
13 Correct 3 ms 544 KB Output is correct
14 Correct 2 ms 544 KB Output is correct
15 Correct 2 ms 544 KB Output is correct
16 Correct 3 ms 544 KB Output is correct
17 Correct 2 ms 544 KB Output is correct
18 Correct 2 ms 544 KB Output is correct
19 Correct 2 ms 544 KB Output is correct
20 Correct 2 ms 544 KB Output is correct
21 Correct 2 ms 544 KB Output is correct
22 Correct 3 ms 544 KB Output is correct
23 Correct 3 ms 544 KB Output is correct
24 Correct 3 ms 544 KB Output is correct
25 Correct 3 ms 544 KB Output is correct
26 Correct 2 ms 544 KB Output is correct
27 Correct 2 ms 544 KB Output is correct
28 Correct 3 ms 544 KB Output is correct
29 Correct 3 ms 628 KB Output is correct
30 Correct 3 ms 628 KB Output is correct
31 Correct 2 ms 628 KB Output is correct
32 Correct 3 ms 628 KB Output is correct
33 Correct 2 ms 628 KB Output is correct
34 Correct 3 ms 628 KB Output is correct
35 Correct 3 ms 636 KB Output is correct
36 Correct 1 ms 636 KB Output is correct
37 Correct 3 ms 636 KB Output is correct
38 Correct 3 ms 636 KB Output is correct
39 Correct 1 ms 636 KB Output is correct
40 Correct 3 ms 636 KB Output is correct
41 Correct 3 ms 636 KB Output is correct
42 Correct 2 ms 636 KB Output is correct
43 Correct 3 ms 636 KB Output is correct
44 Correct 3 ms 636 KB Output is correct
45 Correct 4 ms 636 KB Output is correct
46 Correct 3 ms 636 KB Output is correct
47 Correct 3 ms 636 KB Output is correct
48 Correct 2 ms 636 KB Output is correct
49 Correct 2 ms 636 KB Output is correct
50 Correct 2 ms 636 KB Output is correct
51 Correct 2 ms 636 KB Output is correct
52 Correct 3 ms 636 KB Output is correct
53 Correct 3 ms 636 KB Output is correct
54 Correct 3 ms 636 KB Output is correct
55 Correct 3 ms 636 KB Output is correct
56 Correct 2 ms 636 KB Output is correct
57 Correct 3 ms 636 KB Output is correct
58 Correct 2 ms 636 KB Output is correct
59 Correct 2 ms 636 KB Output is correct
60 Correct 2 ms 636 KB Output is correct
61 Correct 2 ms 636 KB Output is correct
62 Correct 2 ms 636 KB Output is correct
63 Correct 2 ms 636 KB Output is correct
64 Correct 2 ms 636 KB Output is correct
65 Correct 2 ms 636 KB Output is correct
66 Correct 2 ms 636 KB Output is correct
67 Correct 2 ms 636 KB Output is correct
68 Correct 2 ms 636 KB Output is correct
69 Correct 2 ms 636 KB Output is correct
70 Correct 2 ms 636 KB Output is correct
71 Correct 2 ms 636 KB Output is correct
72 Correct 3 ms 636 KB Output is correct
73 Correct 2 ms 636 KB Output is correct
74 Correct 2 ms 636 KB Output is correct
75 Correct 2 ms 636 KB Output is correct
76 Correct 2 ms 636 KB Output is correct
77 Correct 2 ms 636 KB Output is correct
78 Correct 2 ms 636 KB Output is correct
79 Correct 2 ms 636 KB Output is correct
80 Correct 2 ms 636 KB Output is correct
81 Correct 3 ms 636 KB Output is correct
82 Correct 2 ms 636 KB Output is correct