Submission #63168

#TimeUsernameProblemLanguageResultExecution timeMemory
63168kjp4155두 박스 (KOI18_box)C++17
100 / 100
4 ms636 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...