제출 #72354

#제출 시각아이디문제언어결과실행 시간메모리
72354우리는 진실을 잊고 살잖아~~~ (#118)Magic Dowsing (FXCUP3_magic)C++17
0 / 100
2 ms256 KiB
#include "dowsing.h" //#include <iostream> //using namespace std; bool B[101][101]; void FindTreasure(int N) { int x, y, cnt=0; for (int i=1; i<=N; i++){ if (Detect(i, i)){ ++cnt; if (cnt == 2){ y=i; break; } x=i; continue; } } if (cnt > 0){ int c; if (y != x+1) c = x+1; else{ if (y != N) c = N; else c = N-1; } if (Detect(x, c)){ Report(x, y); return; } Report(y, x); return; } cnt=0; for (int i=1; i<=49; i++){ if (Detect(i, 100-i+1)){ ++cnt; x = i; y = 100-i+1; break; } } if (cnt == 0) x = 50, y = 51; int c; if (y != x+1) c = x+1; else{ if (y != N) c = N; else c = N-1; } if (Detect(x, c)) Report(x, x); else Report(y, y); return; }

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

dowsing.cpp: In function 'void FindTreasure(int)':
dowsing.cpp:24:4: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (y != N) c = N;
    ^~
#Verdict Execution timeMemoryGrader output
Fetching results...