# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
820127 | MSK17 | Combo (IOI18_combo) | C++14 | 1 ms | 208 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
std::string s;
std::vector<char> c;
int press(std::string);
std::string make(std::string cur){
std::string ret;
for(int i{}; i < 3; ++i){
ret+=cur;
ret.push_back(c[0]);
ret.push_back(c[i]);
}
ret+=cur;
ret.push_back(c[1]);
return ret;
}
std::string guess_sequence(int n){
int val=press("AB");
if(val)
s=(press("A")==1?"A":"B");
else
s=(press("X")==1?"X":"Y");
std::string all{"ABXY"};
for(char ch: all)
if(s[0]!=ch)
c.push_back(ch);
while(s.length()<n){
int k=s.length();
int cur=press(make(s));
if(cur==k)
s.push_back(c[2]);
else if(cur==k+1)
s.push_back(c[1]);
else s.push_back(c[0]);
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |