제출 #77113

#제출 시각아이디문제언어결과실행 시간메모리
77113kimjihoon콤보 (IOI18_combo)C++14
100 / 100
41 ms492 KiB
#include "combo.h" #include <iostream> #include <string> using namespace std; std::string guess_sequence(int N) { int sr = 0; if (press("AB") > 0) sr += 2; if (press("AX") > 0) sr++; string sc[4] = {"Y", "X", "B", "A"}; string s = ""; s += sc[sr]; string c[3]; int cs = 0; for (int i = 0; i < 4; i++) if (i != sr){ c[cs] = sc[i]; cs++; } for (int i = 1; i < N; i++){ string ts; if (i == N-1) ts = s + c[1] + s + c[2]; else ts = s + c[1] + c[0] + s + c[2] + c[0] + s + c[2] + c[2]; int t = press(ts) - s.length(); if (t != 0 && i == N-1){ int t1 = press(s + c[1]) - s.length(); if (t1 == 0) s += c[2]; else s += c[1]; continue; } if (t == 0) s += c[0]; else if (t == 1){ string ps = s + c[1] + c[2]; int t1 = press(ps) - s.length(); if (t1 == 0) s += c[2] + c[1]; else if (t1 == 1) s += c[1] + c[1]; else s += c[1] + c[2]; i++; } else{ string ps = s + c[2] + c[0]; int t1 = press(ps) - s.length(); if (t1 == 0) s += c[1] + c[0]; else if (t1 == 1) s += c[2] + c[2]; else s += c[2] + c[0]; i++; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...