제출 #24911

#제출 시각아이디문제언어결과실행 시간메모리
24911dotorya산악 구조대 (JOI13_mountain)C++14
100 / 100
24 ms992 KiB
#include "grader.h"
void Rescue(int R, int C, int RS, int CS, int X) {
	int i, j, k;
	
	int ax = -1, ay = -1;
	int x = RS, y = 1;
	while (x >= 1 && x <= R && y >= 1 && y <= C && y <= CS) {
		int t = Measure(x, y);
		if (t == X) ax = x, ay = y;
		if (t >= X) x--;
		else y++;
	}
	x = RS, y = C;
	while (x >= 1 && x <= R && y >= 1 && y <= C && y >= CS) {
		int t = Measure(x, y);
		if (t == X) ax = x, ay = y;
		if (t >= X) x--;
		else y--;
	}
 
	x = RS, y = 1;
	while (x >= 1 && x <= R && y >= 1 && y <= C && y <= CS) {
		int t = Measure(x, y);
		if (t == X) ax = x, ay = y;
		if (t >= X) x++;
		else y++;
	}
	x = RS, y = C;
	while (x >= 1 && x <= R && y >= 1 && y <= C && y >= CS) {
		int t = Measure(x, y);
		if (t == X) ax = x, ay = y;
		if (t >= X) x++;
		else y--;
	}
	Pinpoint(ax, ay);
}

컴파일 시 표준 에러 (stderr) 메시지

mountain.cpp: In function 'void Rescue(int, int, int, int, int)':
mountain.cpp:3:6: warning: unused variable 'i' [-Wunused-variable]
  int i, j, k;
      ^
mountain.cpp:3:9: warning: unused variable 'j' [-Wunused-variable]
  int i, j, k;
         ^
mountain.cpp:3:12: warning: unused variable 'k' [-Wunused-variable]
  int i, j, k;
            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...