Submission #322081

#TimeUsernameProblemLanguageResultExecution timeMemory
322081kwongwengCombo (IOI18_combo)C++14
5 / 100
1 ms256 KiB
#include <bits/stdc++.h>
#include "combo.h";
using namespace std;

string guess_sequence(int n){
    string S = "";
	int a = press("AB");
  	if (a >= 1){
	    int b = press("A");
	    if (b == 1){
	        S += "A";
	    }else{
	        S += "B";
	    }
    }else{
        int b = press("X");
        if (b == 1) S += "X";
        else S += "Y";
    }
    string c = "ABXY";
    string ch = "";
    for (int i = 0; i < 4; i++){
        if (c[i] == S[0]) continue;
        ch += c[i];
    }
    for (int i = 1; i < n-1; i++){
        string ask = S + ch[0] + ch[0] + S + ch[0] + ch[1] + S + ch[0] + ch[2] + S + ch[1];
        int b = press(ask);
        if (b == i) S += ch[2];
        else if (b == i+1) S += ch[1];
        else S += ch[0];
    }
    int b = press(S + ch[0]);
    if (b == n) return S + ch[0];
    else{
        int d = press(S + ch[1]);
        if (d == n) return S + ch[1];
        else return S + ch[2];
    }
}

Compilation message (stderr)

combo.cpp:2:19: warning: extra tokens at end of #include directive
    2 | #include "combo.h";
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...