Submission #330473

# Submission time Handle Problem Language Result Execution time Memory
330473 2020-11-25T12:41:36 Z SnowFlake7 Combo (IOI18_combo) C++14
0 / 100
1 ms 200 KB
#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

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 time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Incorrect 0 ms 200 KB Wrong Answer: wrong guess.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 200 KB Output is correct
2 Correct 1 ms 200 KB Output is correct
3 Correct 0 ms 200 KB Output is correct
4 Correct 1 ms 200 KB Output is correct
5 Correct 0 ms 200 KB Output is correct
6 Correct 0 ms 200 KB Output is correct
7 Incorrect 0 ms 200 KB Wrong Answer: wrong guess.
8 Halted 0 ms 0 KB -