Submission #703149

#TimeUsernameProblemLanguageResultExecution timeMemory
703149PenguinsAreCuteCombo (IOI18_combo)C++17
100 / 100
33 ms648 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string p = ""; char c[4]; c[0] = 'A'; c[1] = 'B'; c[2] = 'X'; c[3] = 'Y'; if(press("AB") == 0) { if(press("X") == 0) p = "Y"; else { p = "X"; c[2] = 'Y'; } } else { if(press("A") == 0) { p = "B"; c[1] = 'Y'; } else { p = "A"; c[0] = 'Y'; } } srand(4206969420); for(int i = 1; i < N - 1; i++) { string s = p + c[2] + c[0] + p + c[2] + c[1] + p + c[2] + c[2] + p + c[1]; p += c[press(s) - i]; } for(int i = max(N - 1, 1); i < N; i++) { for(int j = 1; j < 3; j++) { int sw = rand() % (j + 1); if(sw != j) swap(c[sw], c[j]); } for(int j = 0; j < 3; j++) { if(j == 0) p += c[j]; else p[i] = c[j]; if(j == 2 || press(p) == i + 1) break; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...