# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
820632 | dashka | Combo (IOI18_combo) | C++14 | 25 ms | 664 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.size()<n-1){
int k=s.size();
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]);
}
if(s.size()==n-1){
std::string curs=s;
curs.push_back(c[0]);
curs+=s;
curs.push_back(c[1]);
if(press(curs)==n-1)
s.push_back(c[2]);
else{
curs=s;
curs.push_back(c[0]);
if(press(curs)==n)
s.push_back(c[0]);
else
s.push_back(c[1]);
}
}
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |