Submission #385874

#TimeUsernameProblemLanguageResultExecution timeMemory
385874ismoilovCombo (IOI18_combo)C++14
100 / 100
48 ms592 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; string guess_sequence(int n) { string s, c = "ABXY"; int f, x; f = press("AB"); if(f > 0) { x = press("A"); if(x > 0) s = "A"; else s = "B"; } else { x = press("X"); if(x > 0) s = "X"; else s = "Y"; } f = 1; c.erase(c.find(s), 1); for(int i = 1; i < n-1; i ++) { //cout << f << " " << s << " // "; string v = s + c[1] + s + c[0] + c[0] + s + c[0] + c[1] + s + c[0] + c[2]; x = press(v); if(x == f) { s += c[2]; f ++; continue; } if(x - f == 1) { s += c[1]; f ++; continue; } s += c[0]; f ++; } if(n == 1) return s; x = press(s + c[0]); if(x == n) return s+c[0]; x = press(s + c[1]); if(x == n) return s+c[1]; return s+c[2]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...