Submission #1142556

#TimeUsernameProblemLanguageResultExecution timeMemory
1142556vyaductCombo (IOI18_combo)C++20
100 / 100
8 ms596 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { // Guessing first letter set<string> S; S.insert("A"), S.insert("B"), S.insert("X"), S.insert("Y"); string p = ""; int ans = press("AB"); if (ans >= 1){ ans = press("A"); if (ans == 1) p = "A"; else p = "B"; } else { ans = press("X"); if (ans == 1) p = "X"; else p = "Y"; } if (N == 1) return p; S.erase(p); int c=0; string B, X, Y; for (auto x: S){ if (c == 0) B = x; if (c == 1) X = x; if (c == 2) Y = x; c++; } // Guessing the other letters int cnt=1; for (int i=1;i<N-1;i++){ string trash = (p + B) + (p + X + Y) + (p + X + X) + (p + X + B); ans = press(trash); if (ans == cnt+1) p += B; else if (ans == cnt+2) p += X; else p += Y; cnt++; } // Guessing last letter ans = press(p + B + p + X); if (ans == N){ ans = press(p+X); if (ans == N) p += X; else p += B; } else { p += Y; } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...