제출 #1133447

#제출 시각아이디문제언어결과실행 시간메모리
1133447naneosmic콤보 (IOI18_combo)C++20
5 / 100
0 ms408 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s; if(press("AB")){ if(press("A"))s="A"; else s="B"; }else{ if(press("X"))s="X"; else s="Y"; } vector<char>m; string temp="ABXY"; for(int i=0;i<4;i++)if(temp[i]!=s[0])m.push_back(temp[i]); int sz=1; while(sz<n-1){ string q; q.append(s); q.push_back(m[0]); q.push_back(m[0]); q.append(s); q.push_back(m[0]); q.push_back(m[1]); q.append(s); q.push_back(m[0]); q.push_back(m[2]); q.append(s); q.push_back(m[1]); int num=press(q); if(num==sz+2){ s.push_back(m[0]); }else if(num==sz+1){ s.push_back(m[1]); }else{ s.push_back(m[2]); } sz++; } string q; q.append(s); q.push_back(m[0]); int num=press(q); if(num==n)s.push_back(m[0]); else{ q.pop_back(); q.push_back(m[1]); num=press(q); if(num==n)s.push_back(m[1]); else s.push_back(m[2]); } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...