제출 #284101

#제출 시각아이디문제언어결과실행 시간메모리
284101TheRedstar콤보 (IOI18_combo)C++11
100 / 100
44 ms648 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; /* int press(string code) { cout << "Common in code "<<code<<": "; int n; cin >> n; return n; }*/ string guess_sequence(int N) { //test case if(N==1) { if(press("A")) return "A"; if(press("B")) return "B"; if(press("X")) return "X"; return "Y"; } string code=""; string opts; //get first char if(press("AB")) { if(press("A")) {code="A";opts="BXY";} else {code="B";opts="AXY";} } else { if(press("X")) {code="X";opts="ABY";} else {code="Y";opts="ABX";} } //get middle chars for(int i=1; i<N-1; i++) { string p=code+opts[1]; for(char c:opts) {p+=code+opts[2]+c;} int val=press(p); if(val==i) code+=opts[0]; else if(val==i+1) code+=opts[1]; else code+=opts[2]; } //get last char if(press(code+opts[0])==N) code+=opts[0]; else if(press(code+opts[1])==N) code+=opts[1]; else code+=opts[2]; return code; } /* int main() { string code="ABXYY"; cout << code << endl; cout << guess_sequence(5) << endl; }*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...