Submission #991138

#TimeUsernameProblemLanguageResultExecution timeMemory
991138RaduMCombo (IOI18_combo)C++17
100 / 100
24 ms1748 KiB
#include <iostream> #include "combo.h" using namespace std; string guess_sequence(int n){ string rez, l; if(press("AB")){ if(press("A")){ rez += 'A'; l = "BXY"; } else{ rez += 'B'; l = "AXY"; } } else if(press("X")){ rez += 'X'; l = "ABY"; } else{ rez += 'Y'; l = "ABX"; } for(int i = 2; i < n; i++){ string temp = ""; for(auto x : l) temp += rez + l[0] + x; temp += rez + l[1]; int x = press(temp); if(x == i + 1) rez += l[0]; else if(x == i) rez += l[1]; else rez += l[2]; } if(n > 1){ if(press(rez + l[0]) == n) rez += l[0]; else if(press(rez + l[1]) == n) rez += l[1]; else rez += l[2]; } return rez; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...