제출 #554339

#제출 시각아이디문제언어결과실행 시간메모리
554339n0sk1ll콤보 (IOI18_combo)C++14
100 / 100
25 ms556 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; vector<string> c(3); string guess_sequence(int n) { string s="",p; if (press("XY")) { if (press("X")) s="X"; else s="Y"; } else { if (press("A")) s="A"; else s="B"; } if (s=="X") c={"A","B","Y"}; else if (s=="Y") c={"A","B","X"}; else if (s=="A") c={"X","Y","B"}; else c={"X","Y","A"}; while ((int)s.size()<n-1) { int i=(int)s.size(); int coins=press(s+c[0]+c[0]+s+c[0]+c[1]+s+c[1]+c[1]); if (coins==i) s+=c[2]; else if (coins==i+1) { coins=press(s+c[1]+c[0]); if (coins>=i+2) s+=c[1]+c[0]; else if (coins==i+1) s+=c[1]+c[2]; else s+=c[0]+c[2]; } else { coins=press(s+c[0]+c[0]); if (coins>=i+2) s+=c[0]+c[0]; else if (coins==i+1) s+=c[0]+c[1]; else s+=c[1]+c[1]; } } if ((int)s.size()<n) { if (press(s+"X"+s+"Y")>n-1) { if (press(s+"X")>n-1) s+="X"; else s+="Y"; } else { if (press(s+"A")>n-1) s+="A"; else s+="B"; } } //cout<<s<<endl; return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...