제출 #256781

#제출 시각아이디문제언어결과실행 시간메모리
256781lani1akea콤보 (IOI18_combo)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { string p = ""; vector<char> LET = {'A', 'B', 'X', 'Y'}; int x, y, st = 0; y = press({"AB"}); if (y >= 1) { st = y; p += (y == 2 ? "AB" : "A"); } else { y = press({"BX"}); if (y >= 1) { st = y; p += (y == 2 ? "BX" : "B"); } else { y = press({"XY"}); if (y >= 1) { st = y; p += (y == 2 ? "XY" : "X"); } else { st = 1; p += "Y"; } } } if (p[0] == 'A') LET.erase(LET.begin()); else if (p[0] == 'B') LET.erase(LET.begin() + 1); else if (p[0] == 'X') LET.erase(LET.begin() + 2); else LET.erase(LET.begin() + 3); for (int i = st; i < N; ++i) { set<int>s; while(true) { random_shuffle(LET.begin(), LET.end()); if (s.count(LET[0])) { continue; } else if (s.size() == 2) { if (!s.count('A') and binary_search(LET.begin(), LET.end(), 'A')) { p += 'A'; break; } else if (!s.count('B') and binary_search(LET.begin(), LET.end(), 'B')) { p += 'B'; break; } else if (!s.count('X') and binary_search(LET.begin(), LET.end(), 'X')) { p += 'X'; break; } else { p += 'Y'; break; } } y = press(p + LET[0] + LET[1] + LET[2]); if (y >= i + 1) { if (y == i + 1) { p += LET[0]; } else if ( y == i + 2) { p += LET[0]; p += LET[1]; ++i; } else { p += LET[0]; p += LET[1]; p += LET[2]; i += 2; } break; } else { s.insert(LET[0]); continue; } } } return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:9:7: warning: unused variable 'x' [-Wunused-variable]
    9 |   int x, y, st = 0;
      |       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...