Submission #95572

#TimeUsernameProblemLanguageResultExecution timeMemory
95572dwscCombo (IOI18_combo)C++14
0 / 100
2 ms256 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { if (N == 1){ if (press("AAAA")) return "A"; if (press("BBBB")) return "B"; if (press("XXXX")) return "X"; return "Y"; } string p = ""; string ans = ""; for (int i = 0; i < N; i++) p += 'A'; for (int i = 0; i < N; i++) p += 'B'; for (int i = 0; i < 2*N; i++) p += 'X'; int val = press(p); if (val == 0){ ans += 'Y'; } else{ p = ""; p += 'A'; p += 'B'; for (int i = 0; i< N-2; i++) p += 'A'; p += 'A'; p += 'X'; for (int i = 0; i< N-2; i++) p += 'A'; p += 'A'; p += 'Y'; for (int i = 0; i< N-2; i++) p += 'A'; for (int i = 0; i < N; i++) p += 'B'; int val2 = press(p); if (val2 > 1) ans += 'A'; else if (val2 == 1) ans += 'B'; else ans += 'C'; } vector<char> c; char start = ans[0]; if (ans != "A")c.push_back('A'); if (ans != "B")c.push_back('B'); if (ans != "X")c.push_back('X'); if (ans != "Y")c.push_back('Y'); for (int i = 1; i < N-1; i++){ p = ""; for (int j = 0; j < 4; j++){ for (int k = 0; k < i; k++) p += ans[k]; if (j == 3){ p += c[1]; p += start; } else{ p += c[0]; p += c[j]; } for (int k = i+2; k < N; k++) p += start; } int temp = press(p); //cout << p << " " << temp << "\n"; if (temp == i) ans += c[2]; else if (temp == i+1) ans += c[1]; else ans += c[0]; } p = ""; for (int i = 0; i < 4; i++){ for (int j = 0; j < N-1; j++) p += ans[j]; if (i < 2) p += c[i]; else p += start; } int temp1 = press(p); if (temp1 == N){ p = ""; for (int i = 0; i < 4; i++){ for (int j = 0; j < N-1; j++) p += ans[j]; if (i < 1) p += c[i]; else p += start; } int temp2 = press(p); if (temp2 == N) ans += c[0]; else ans += c[1]; } else{ ans += c[2]; } //cout << ans; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...