Submission #309631

#TimeUsernameProblemLanguageResultExecution timeMemory
309631Genius1506Combo (IOI18_combo)C++14
5 / 100
1 ms200 KiB
#include<bits/stdc++.h>
#include "combo.h";
using namespace std;
 
string guess_sequence(int n){
    string ans;
    char a='A',b='B',c='Y';
    if(press("AB")){
        if(press("A")){
            ans="A";
            a='X';
        }
        else{
            ans="B";
            b='X';
        }
    }
    else{
        if(press("X")){
            ans="X";
        }
        else{
            ans="Y";
          	c='X';
        }
    }
    for(int i = 2; i < n; i++){
        int chu = press(ans+a+ans+b+a+ans+b+b+ans+b+c);
        if(chu==i)
            ans+=a;
        else if(chu==i+1)
            ans+=b;
        else 
            ans+=c;
    }   
    if(n>=2){
        if(press(ans+a)==n)
            ans+=a;
        else if(press(ans+b)==n)
            ans+=b;
        else
            ans+=c;
        return ans;
    }
}

Compilation message (stderr)

combo.cpp:2:19: warning: extra tokens at end of #include directive
    2 | #include "combo.h";
      |                   ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:45:1: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...