# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
998322 | Roman70 | 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 <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
string correct;
int sz[3];
sz[0] = sz[1] = sz[2] = 0;
char flag;
while(correct.size() != N){
if(!correct.size()){
int sz[3];
sz[0] = press("A");
sz[1] = press("B");
sz[2] = press("X");
if(sz[0]) {
correct.push_back('A');
flag = 'A';
}
else if(sz[1]){
correct.push_back('B');
flag = 'B';
}
else if(sz[2]){
correct.push_back('X');
flag = 'X';
}
else{
correct.push_back('Y');
flag = 'Y';
}
}
else{
if(flag == 'A'){
sz[0] = press(correct + "B");
sz[1] = press(correct + "X");
if(sz[0]){
correct.push_back('B');
}
else if(sz[1]){
correct.push_back('X');
}
else
correct.push_back('Y');
}
else if(flag == 'B'){
sz[0] = press(correct + "A");
sz[1] = press(correct + "X");
if(sz[0]){
correct.push_back('A');
}
else if(sz[1]){
correct.push_back('X');
}
else
correct.push_back('Y');
}
else if(flag == 'X'){
sz[0] = press(correct + "A");
sz[1] = press(correct +"B");
if(sz[0]){
correct.push_back('A');
}
else if(sz[1]){
correct.push_back('B');
}
else
correct.push_back('Y');
}
else if(flag == 'Y'){
sz[0] = press(correct + "A");
sz[1] = press(correct +"B");
if(sz[0]){
correct.push_back('A');
}
else if(sz[1]){
correct.push_back('B');
}
else
correct.push_back('X');
}
}
}
return correct;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |