제출 #142634

#제출 시각아이디문제언어결과실행 시간메모리
142634Berted콤보 (IOI18_combo)C++14
100 / 100
49 ms548 KiB
#include "combo.h" #include <iostream> using namespace std; string guess_sequence(int N) { int n = press("AB");char ar[3]={};string cr="",tcr; if (n>0) { n = press("A"); if (n==1) {cr+='A';ar[0]='B';ar[1]='X';ar[2]='Y';} else {cr+='B';ar[0]='A';ar[1]='X';ar[2]='Y';} } else { n = press("X"); if (n==1) {cr+='X';ar[0]='A';ar[1]='B';ar[2]='Y';} else {cr+='Y';ar[0]='A';ar[1]='B';ar[2]='X';} } if (N==1) {return cr;} for (int i=1;i<N-1;i++) { tcr=cr+ar[0]; for (int j=0;j<3;j++) {tcr+=cr+ar[1]+ar[j];} n = press(tcr); if (n==i) {cr+=ar[2];} else if (n==i+1) {cr+=ar[0];} else {cr+=ar[1];} } n = press(cr+ar[0]); if (n==N) {return cr+ar[0];} else { n = press(cr+ar[1]); if (n==N) {return cr+ar[1];} else {return cr+ar[2];} } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...