제출 #1007460

#제출 시각아이디문제언어결과실행 시간메모리
1007460makanhulia콤보 (IOI18_combo)C++17
0 / 100
0 ms344 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; /* c = "abxy" n = 8 abbxyxxb y = n x = n b = n udah pasti a abax */ string guess_sequence(int n) { // guess 1st char of s // sisa question: n + 2 - 2 = n string s; int val = press("AB"); if (val == 2) { s = "A"; } else if (val == 1) { if (press("A")) { s = "A"; } else { s = "B"; } } else if (press("X")) { s = "X"; } else { s = "Y"; } // length sisa (n - 1), question sisa n vector<string> ch; if (s[0] != 'A') { ch.push_back("A"); } if (s[0] != 'B') { ch.push_back("B"); } if (s[0] != 'X') { ch.push_back("X"); } if (s[0] != 'Y') { ch.push_back("Y"); } for (int i = 2; i <= n - 1; ++i) { val = press(s + ch[0] + s + ch[1] + ch[0] + s + ch[1] + ch[1] + s + ch[1] + ch[2]); if (val == i - 1) { s += ch[2]; } else if (val == i) { s += ch[0]; } else { // val == i + 1 s += ch[1]; } } if (press(s + ch[0])) { s += ch[0]; } else if (press(s + ch[1]) == n) { s += ch[1]; } else { s += ch[2]; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...