제출 #164713

#제출 시각아이디문제언어결과실행 시간메모리
164713IgorI콤보 (IOI18_combo)C++17
0 / 100
2 ms200 KiB
#include <combo.h> #include <iostream> #include <string> using namespace std; typedef long long ll; string guess_sequence(int n) { string s; int r = press("AB"); if (r) { int q = press("A"); if (q) s += "A"; else s += "B"; } else { int q = press("X"); if (q) s += "X"; else s += "Y"; } for (int i = 1; i < n; i++) { string r; int q; if (s[0] == 'A') r = s + "BB" + s + "BX" + s + "BY" + s + "X"; if (s[0] == 'B') r = s + "AA" + s + "AX" + s + "AY" + s + "X"; if (s[0] == 'X') r = s + "AA" + s + "AB" + s + "AY" + s + "B"; if (s[0] == 'Y') r = s + "AA" + s + "AB" + s + "AX" + s + "B"; q = press(r) - i; if (s[0] == 'A') if (q == 0) s += "Y"; else if (q == 1) s += "X"; else if (q == 2) s += "B"; if (s[0] != 'A') { if (q == 2) s += "A"; if (s[0] == 'B') if (q == 0) s += "Y"; else if (q == 1) s += "X"; if (s[0] != 'B') { if (q == 1) s += "B"; if (s[0] == 'X') if (q == 0) s += "Y"; if (s[0] != 'X') { if (q == 0) s += 'X'; } } } } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:30:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   30 |         if (s[0] == 'A') if (q == 0) s += "Y"; else if (q == 1) s += "X"; else if (q == 2) s += "B";
      |            ^
combo.cpp:34:16: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   34 |             if (s[0] == 'B') if (q == 0) s += "Y"; else if (q == 1) s += "X";
      |                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...