Submission #330475

#TimeUsernameProblemLanguageResultExecution timeMemory
330475SnowFlake7Combo (IOI18_combo)C++14
0 / 100
2 ms200 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string guess_sequence(int n) {
    string S = "",ch = "ABXY",c = "",s;
    int a,b;
	a = press("AB");
  	if (a >= 1) {
	    b = press("A");
	    if (b == 1)
	        S += "A";
	    else
	        S += "B";
    }
    else {
        b = press("X");
        if (b == 1)
            S += "X";
        else
            S += "Y";
    }
    if (n == 1)
        return S;
    for (int i = 0;i < 4;i++){
        if (c[i] == S[0])
            continue;
        ch += c[i];
    }
    for (int i = 1;i < n - 1;i++){
        s = S + ch[0] + ch[0] + S + ch[0] + ch[1] + S + ch[0] + ch[2] + S + ch[1];
        b = press(s);
        if (b == i)
            S += ch[2];
        else if (b == i + 1)
            S += ch[1];
        else
        S += ch[0];
    }
    b = press(S + ch[0]);
    if (b == n)
        S += ch[0];
	else {
        a = press(S + ch[1]);
        if (a == n)
            S += ch[1];
        else
            S += ch[2];
	}
	return S;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...