제출 #713636

#제출 시각아이디문제언어결과실행 시간메모리
713636dimuslv콤보 (IOI18_combo)C++17
100 / 100
34 ms584 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { /*std::string p = ""; for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); std::string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; }*/ string answ, left; int coins; if (press("AB")) { if (press("A")) { answ = "A"; left = "BXY"; } else { answ = "B"; left = "AXY"; } } else if (press("X")) { answ = "X"; left = "ABY"; } else { answ = "Y"; left = "ABX"; } if (N == 1) return answ; for (int i = 1; i < N-1; i++) { coins = press(answ + left[0] + left[0] + answ + left[0] + left[1] + answ + left[0] + left[2] + answ + left[1]); if (coins == i + 2) { answ += left[0]; } else if (coins == i+1) { answ += left[1]; } else { answ += left[2]; } } if(press(answ + left[0] + answ + left[1]) == N) { if (press(answ + left[0]) == N) { answ += left[0]; } else { answ += left[1]; } } else { answ += left[2]; } return answ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...