Submission #330473

#TimeUsernameProblemLanguageResultExecution timeMemory
330473SnowFlake7Combo (IOI18_combo)C++14
0 / 100
1 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)
        return S + ch[0];
	b = press(S + ch[1]);
    if (b == n)
        return S + ch[1];
    return S + ch[2];
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:42:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   42 |     if (b == n)
      |     ^~
combo.cpp:44:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   44 |  b = press(S + ch[1]);
      |  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...