제출 #936687

#제출 시각아이디문제언어결과실행 시간메모리
9366874QT0R콤보 (IOI18_combo)C++17
100 / 100
12 ms1752 KiB
#include <combo.h> #include <bits/stdc++.h> using namespace std; char zn[4]={'A','B','X','Y'}; string guess_sequence(int n){ string s=""; s+=zn[0]; s+=zn[1]; if (press(s)>=1){ s=""; s+=zn[0]; if (press(s)==0)swap(zn[0],zn[1]); } else{ s=""; s+=zn[2]; if (press(s)==0)swap(zn[0],zn[3]); else swap(zn[0],zn[2]); } s=""; s+=zn[0]; if (n==1)return s; int wyn; string cur; for (int i = 1; i<n-1; i++){ cur=""; cur+=s;cur+=zn[1];cur+=zn[1]; cur+=s;cur+=zn[1];cur+=zn[2]; cur+=s;cur+=zn[1];cur+=zn[3]; cur+=s;cur+=zn[2]; wyn=press(cur); if (wyn==i)s+=zn[3]; else if (wyn==i+1)s+=zn[2]; else s+=zn[1]; } cur=s; cur+=zn[1]; cur+=s; cur+=zn[2]; wyn=press(cur); if (wyn==n-1){ s+=zn[3]; } else{ cur=s; cur+=zn[1]; wyn=press(cur); if (wyn==n)s+=zn[1]; else s+=zn[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...