제출 #118351

#제출 시각아이디문제언어결과실행 시간메모리
118351alexandra_udristoiu콤보 (IOI18_combo)C++14
100 / 100
55 ms524 KiB
#include<iostream> #include "combo.h" using namespace std; string guess_sequence(int n){ int i, j; string s, sol; char c[5] = "ABXY"; s = c[0]; s += c[1]; if(press(s) > 0){ s = c[1]; if(press(s) == 1){ swap(c[0], c[1]); } } else{ s = c[2]; if(press(s) == 1){ swap(c[0], c[2]); } else{ swap(c[0], c[3]); } } sol = c[0]; if(n == 1){ return sol; } for(i = 2; i < n; i++){ s = sol; s += c[1]; for(j = 1; j < 4; j++){ s += sol; s += c[2]; s += c[j]; } int x = press(s); if(x == i - 1){ sol += c[3]; } else{ if(x == i){ sol += c[1]; } else{ sol += c[2]; } } } s = sol; s += c[1]; if(press(s) == n){ sol += c[1]; } else{ s = sol; s += c[2]; if(press(s) == n){ sol += c[2]; } else{ sol += c[3]; } } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...