제출 #72179

#제출 시각아이디문제언어결과실행 시간메모리
72179인프라웨어 상한가 가주세요. 물렸어요 (#118)마법 다우징 (FXCUP3_magic)C++17
60 / 100
4 ms376 KiB
#include  "dowsing.h"

void  FindTreasure(int  N)  {
	int xIdx = -1, yIdx = -1;
	int x0 = -1, y0 = -1;
	int x1 = -1, y1 = -1;
	int cntOne = 0;
	for (int i = 1; i <= N; ++i) {
		int check = Detect(1, i);
		if (check == 1) {
			cntOne++;
			x1 = 1;
			y1 = i;
		}
		else {
			// ��ΰ� 1�ΰ�� ����
			x0 = 1;
			y0 = i;
		}
	}
	if (cntOne >= 2) {
		Report(x0, y0);
	}
	else {
		yIdx = y1;
		for (int i = 1; i <= N; ++i) {
			int check = Detect(i, yIdx);
			if (check == 0) {
				Report(i, yIdx);
				break;
			}
		}
	}
	return;
}

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

dowsing.cpp: In function 'void FindTreasure(int)':
dowsing.cpp:4:6: warning: unused variable 'xIdx' [-Wunused-variable]
  int xIdx = -1, yIdx = -1;
      ^~~~
dowsing.cpp:6:6: warning: variable 'x1' set but not used [-Wunused-but-set-variable]
  int x1 = -1, y1 = -1;
      ^~
#Verdict Execution timeMemoryGrader output
Fetching results...