Submission #766197

#TimeUsernameProblemLanguageResultExecution timeMemory
766197amunduzbaevCombo (IOI18_combo)C++17
100 / 100
31 ms568 KiB
#include "combo.h" #include "bits/stdc++.h" using namespace std; #define ar array typedef long long ll; typedef int32_t ii; //~ #define int ll #ifndef EVAL #include "grader.cpp" #endif string guess_sequence(ii n) { string s; if(press("AB")){ if(press("A")) s = "A"; else s = "B"; } else { if(press("X")) s = "X"; else s = "Y"; } string rem, Char = "ABXY"; for(auto x : Char){ if(s[0] != x){ rem.push_back(x); } } assert(rem.size() == 3); for(int i=2;i<n;i++){ string t = s + rem[0] + s + rem[1] + rem[0] + s + rem[1] + rem[1] + s + rem[1] + rem[2]; int len = press(t); if(len == i){ s.push_back(rem[0]); } if(len == i + 1){ s.push_back(rem[1]); } if(len == i - 1){ s.push_back(rem[2]); } } if(n > 1){ if(press(string(s + rem[0])) == n){ s.push_back(rem[0]); } else if(press(string(s + rem[1])) == n){ s.push_back(rem[1]); } else { s.push_back(rem[2]); } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...