Submission #478252

#TimeUsernameProblemLanguageResultExecution timeMemory
478252ColourAttilaCombo (IOI18_combo)C++17
100 / 100
38 ms584 KiB
#include<bits/stdc++.h> #include<combo.h> using namespace std; string guess_sequence(int N) { string mo = ""; int first = press("AB"), second; if(first) { second = press("A"); if(second) mo = "A"; else mo = "B"; } else { second = press("X"); if(second) mo = "X"; else mo = "Y"; } if(N == 1) return mo; string elements = "ABXY"; vector<char> notFirst; for(char c : elements) { if(c != mo[0]) notFirst.push_back(c); } for(int i = 1; i < N - 1; i++) { string temp = ""; temp += mo + notFirst[0] + notFirst[0]; temp += mo + notFirst[0] + notFirst[1]; temp += mo + notFirst[0] + notFirst[2]; temp += mo + notFirst[1]; int ans = press(temp); if(ans == i) { mo += notFirst[2]; } else if(ans == i+1) { mo += notFirst[1]; } else { mo += notFirst[0]; } } bool b = false; for(int i = 0; i < 2; i++) { int temp = press(mo + notFirst[i]); if(temp == N) { b = true; mo += notFirst[i]; break; } } if(!b) mo += notFirst[2]; return mo; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...