답안 #72179

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72179 2018-08-26T05:47:40 Z 인프라웨어 상한가 가주세요. 물렸어요(#2188, c4big, cepiloth) 마법 다우징 (FXCUP3_magic) C++17
60 / 100
4 ms 376 KB
#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;
}

Compilation message

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;
      ^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Correct : C = 5
2 Correct 2 ms 256 KB Correct : C = 5
3 Partially correct 3 ms 376 KB Partially correct : C = 197
4 Partially correct 3 ms 376 KB Partially correct : C = 196
5 Partially correct 3 ms 376 KB Partially correct : C = 199
6 Partially correct 3 ms 376 KB Partially correct : C = 198
7 Partially correct 3 ms 376 KB Partially correct : C = 196
8 Partially correct 4 ms 376 KB Partially correct : C = 196
9 Partially correct 4 ms 376 KB Partially correct : C = 198
10 Partially correct 4 ms 376 KB Partially correct : C = 200
11 Partially correct 3 ms 376 KB Partially correct : C = 197
12 Partially correct 3 ms 376 KB Partially correct : C = 197