Submission #398342

#TimeUsernameProblemLanguageResultExecution timeMemory
398342kevinxiehkCombo (IOI18_combo)C++17
100 / 100
62 ms568 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; string guess_sequence(int n) { string p = ""; string lef = ""; int a = press("AB"); if(a >= 1) { a = press("A"); p = (a == 1 ? "A" : "B"); lef = (a == 1 ? "BXY" : "AXY"); } else { a = press("X"); p = (a == 1 ? "X" : "Y"); lef = (a == 1 ? "ABY" : "ABX"); } for(int i = 2; i < n; i++) { string guess = ""; guess += p; guess += lef[0]; guess += lef[0]; guess += p; guess += lef[0]; guess += lef[1]; guess += p; guess += lef[0]; guess += lef[2]; guess += p; guess += lef[1]; a = press(guess); if(a - p.length() == 0) { p += lef[2]; } else if(a - p.length() == 1) { p += lef[1]; } else p += lef[0]; } if(n >= 2) { a = press(p + lef[0] + p + lef[1]); if(a - p.length() == 0) p += lef[2]; else { a = press(p + lef[0]); if(a - p.length() == 0) p += lef[1]; else p += lef[0]; } } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...