제출 #860586

#제출 시각아이디문제언어결과실행 시간메모리
860586HakiersCombo (IOI18_combo)C++17
5 / 100
1 ms596 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string dictionary[4]; void make_dictionary(){ if(press("A")){ //dictionary = {"A", "B", "X", "Y"}; dictionary[0] = "A"; dictionary[1] = "B"; dictionary[2] = "X"; dictionary[3] = "Y"; } else if(press("B")){ //dictionary = {"B", "A", "X", "Y"}; dictionary[0] = "B"; dictionary[1] = "A"; dictionary[2] = "X"; dictionary[3] = "Y"; } else if(press("X")){ //dictionary = {"X", "A", "B", "Y"}; dictionary[0] = "X"; dictionary[1] = "A"; dictionary[2] = "B"; dictionary[3] = "Y"; } else{ //dictionary = {"Y", "A", "B", "X"}; dictionary[0] = "Y"; dictionary[1] = "A"; dictionary[2] = "B"; dictionary[3] = "X"; } } string make_p(string p, int v, int n){ //#A##### string act = p; act += dictionary[1]; for(int i = v+1; i <= n; i++) act+= dictionary[0]; //#BA#### act += p; act += dictionary[2] + dictionary[1]; for(int i = v+2; i <= n; i++) act+= dictionary[0]; //#BB#### act += p; act += dictionary[2] + dictionary[2]; for(int i = v+2; i <= n; i++) act+= dictionary[0]; //#BX#### act += p; act += dictionary[2] + dictionary[3]; for(int i = v+2; i <= n; i++) act+= dictionary[0]; return act; } string solve(int n){ make_dictionary(); string act = dictionary[0]; for(int i = 2; i < n; i++){ string p = make_p(act, i, n); int query = press(p); if(query == i) act += dictionary[1]; else if(query == i+1) act += dictionary[2]; else act += dictionary[3]; } //teraz ostatni if(press(act + dictionary[1]) == n) act += dictionary[1]; else if(press(act + dictionary[2]) == n) return act += dictionary[2]; else act += dictionary[3]; return act; } string guess_sequence(int N){ return solve(N); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...