제출 #403454

#제출 시각아이디문제언어결과실행 시간메모리
403454InternetPerson10콤보 (IOI18_combo)C++14
100 / 100
48 ms824 KiB
#include "combo.h" #include <string> #include <vector> using namespace std; string guess_sequence(int N) { vector<string> c; c.push_back("A"); c.push_back("B"); c.push_back("X"); c.push_back("Y"); string s, ss; int co, a, b, d; a = b = d = 1; s = c[0] + c[1]; co = press(s); if(co > 0) { co = press(c[0]); if(co > 0) s = c[0]; else s = c[1]; } else { co = press(c[2]); if(co > 0) s = c[2]; else s = c[3]; } for(int i = 0; i < 4; i++) { if(s == c[i]) { a = (i+1)%4; b = (i+2)%4; d = (i+3)%4; } } if(N == 1) return s; for(int i = 1; i < N-1; i++) { string s1 = s + c[a] + c[a]; string s2 = s + c[a] + c[b]; string s3 = s + c[a] + c[d]; string s4 = s + c[b]; ss = s1 + s2 + s3 + s4; co = press(ss); if(co == i+2) s = s + c[a]; else if(co == i+1) s = s + c[b]; else s = s + c[d]; } ss = s + c[a]; co = press(ss); if(co == N) s = s + c[a]; else { ss = s + c[b]; co = press(ss); if(co == N) s = s + c[b]; else s = s + c[d]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...