제출 #140669

#제출 시각아이디문제언어결과실행 시간메모리
140669Nerarith콤보 (IOI18_combo)C++14
100 / 100
39 ms680 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; int press (string p); string guess_sequence(int n) { char tr, alt, fir; if (press("AB")) tr = 'A', alt = 'B'; else tr = 'X', alt = 'Y'; string ss = ""; ss += tr; if (press(ss)) fir = tr; else fir = alt; string pr = ""; pr += fir; if (n==1) return pr; string cs = "ABXY"; cs.erase(cs.find(fir), 1); for (int i=1; i < n-1; i++) { string s = pr + cs[1] + pr + cs[2]+cs[0] + pr + cs[2]+cs[1] + pr + cs[2]+cs[2]; int res = press(s); if (res==i) pr += cs[0]; else if (res==i+1) pr += cs[1]; else pr += cs[2]; } if (press(pr+cs[0])==n) return pr+cs[0]; if (press(pr+cs[1])==n) return pr+cs[1]; return pr+cs[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...