답안 #63166

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
63166 2018-08-01T01:47:05 Z kjp4155 두 박스 (KOI18_box) C++17
컴파일 오류
0 ms 0 KB
#include <stdio.h>
#include <algorithm>

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

	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;

	if( xdiff > 0 && ydiff > 0 ) printf("FACE\n");
	else if( xdiff == 0 && ydiff > 0 ) printf("LINE\n");
	else if( xdiff > 0 && ydiff == 0 ) printf("LINE\n");
	else if( xdiff == 0 && ydiff == 0 ) printf("POINT\n");
	else printf("NULL\n");
}

Compilation message

box.cpp: In function 'int main()':
box.cpp:10:15: error: 'max' was not declared in this scope
  int x_left = max(px1, qx1);
               ^~~
box.cpp:10:15: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from box.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3468:5: note:   'std::max'
     max(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
box.cpp:11:16: error: 'min' was not declared in this scope
  int x_right = min(px2, qx2);
                ^~~
box.cpp:11:16: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from box.cpp:2:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
box.cpp:7: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:8: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);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~