제출 #144331

#제출 시각아이디문제언어결과실행 시간메모리
144331mosesmayer콤보 (IOI18_combo)C++17
100 / 100
45 ms524 KiB
#include "combo.h" #include <iostream> #include <string> using namespace std; std::string guess_sequence(int N) { std::string p = ""; string guess, ans = ""; char g[3]; guess = "AB"; int ret = press("AB"); if (ret >= 1){ ret = press("A"); if (ret == 0){ ans += "B"; g[0] = 'A', g[1] = 'X', g[2] = 'Y'; } else { ans += "A"; g[0] = 'B', g[1] = 'X', g[2] = 'Y'; } } else { ret = press("X"); if (ret == 0){ ans += "Y"; g[0] = 'A', g[1] = 'X', g[2] = 'B'; } else { ans += "X"; g[0] = 'B', g[1] = 'A', g[2] = 'Y'; } } for (int i = 2; i <= N-1; i++){ guess = ""; guess += ans; guess += g[0]; guess += g[0]; guess += ans; guess += g[0]; guess += g[1]; guess += ans; guess += g[0]; guess += g[2]; guess += ans; guess += g[1]; ret = press(guess) - ans.length(); if (ret == 0){ ans += g[2]; } else if (ret == 1){ ans += g[1]; } else { ans += g[0]; } } if (N==1) return ans; guess = ans + g[0] + ans + g[1]; ret = press(guess) - ans.length(); if (ret >= 1){ guess = ans + g[0]; ret = press(guess) - ans.length(); if (ret == 0) ans += g[1]; else ans += g[0]; } else { ans += g[2]; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...