# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1057427 | ender | Combo (IOI18_combo) | C++17 | 1 ms | 344 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 "combo.h"
#include <bits/stdc++.h>
using namespace std;
std::string guess_sequence(int N) {
vector<char> c = {'A', 'B', 'X', 'Y'};
string s = "";
int coins = 0;
for(int i = 0; i < 4; ++i){
if(i == 3){
s += c[i];
c.erase(c.begin() + i);
coins = 1;
break;
}
if(press(s+c[i]) > coins){
s += c[i];
c.erase(c.begin() + i);
coins = 1;
break;
}
}
while(coins != N){
cout << s << " 0" << "\n";
vector<string> cs(3);
string p = "";
for(int i = 0; i < 3; ++i){
cs[i] = s + c[i];
if(cs[i].size() == N) {
cs[i] += cs[i];
continue;
}
cs[i] += (c[0] + cs[i] + c[1]);
cout << cs[i] << "\n";
}
for(auto &i : cs){
cout << i << "\n";
int cur = press(i);
if(cur == coins + 1){
if(i.size()/2 == N){
s += i[i.size()-1];
coins++;
break;
}
s += i[i.size()-2];
s += c[2];
coins += 2;
break;
} else if (cur == coins + 2){
string subcur = i.substr(0, N);
if(press(subcur) == cur) {
s += subcur.substr(N-2, 2);
coins += 2;
break;
} else {
s += i.substr(i.size() - 2, 2);
coins += 2;
break;
}
}
}
}
cout << s << "\n";
return s;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |