Submission #226620

#TimeUsernameProblemLanguageResultExecution timeMemory
226620AaronNaiduCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
include "combo.h"
using namespace std;

string guess_sequence(int n) {
    string toRet;
    if (n == 1)
    {
        if (press("A"))
        {
            return "A";
        }
        if (press("B"))
        {
            return "B";
        }
        if (press("X"))
        {
            return "X";
        }
        return "Y";
    }
    
    if (press("AB"))
    {
        if (press("A"))
        {
            toRet = "A";
            for (int i = 1; i < n-1; i++)
            {
                int x = press(toRet + "B" + toRet + "XB" + toRet + "XY" + toRet + "XX");
                if (x == i)
                {
                    toRet = toRet + "Y";
                }
                else if (x == i + 1)
                {
                    toRet = toRet + "B";
                }
                else
                {
                    toRet = toRet + "X";
                }
            }
            if (press(toRet + "B") == n)
            {
                return toRet + "B";
            }
            if (press(toRet + "X") == n)
            {
                return toRet + "X";
            }            
            return toRet + "Y";
        }
        else
        {
            toRet = "B";
            for (int i = 1; i < n-1; i++)
            {
                int x = press(toRet + "A" + toRet + "XA" + toRet + "XY" + toRet + "XX");
                if (x == i)
                {
                    toRet = toRet + "Y";
                }
                else if (x == i + 1)
                {
                    toRet = toRet + "A";
                }
                else
                {
                    toRet = toRet + "X";
                }
            }
            if (press(toRet + "A") == n)
            {
                return toRet + "A";
            }
            if (press(toRet + "X") == n)
            {
                return toRet + "X";
            }            
            return toRet + "Y";
        }   
    }
    else
    {
        if (press("X"))
        {
            toRet = "X";
            for (int i = 1; i < n-1; i++)
            {
                int x = press(toRet + "B" + toRet + "AB" + toRet + "AY" + toRet + "AA");
                if (x == i)
                {
                    toRet = toRet + "Y";
                }
                else if (x == i + 1)
                {
                    toRet = toRet + "B";
                }
                else
                {
                    toRet = toRet + "A";
                }
            }
            if (press(toRet + "B") == n)
            {
                return toRet + "B";
            }
            if (press(toRet + "A") == n)
            {
                return toRet + "A";
            }            
            return toRet + "Y";
        }
        else
        {
            toRet = "Y";
            for (int i = 1; i < n-1; i++)
            {
                int x = press(toRet + "B" + toRet + "XB" + toRet + "XA" + toRet + "XX");
                if (x == i)
                {
                    toRet = toRet + "A";
                }
                else if (x == i + 1)
                {
                    toRet = toRet + "B";
                }
                else
                {
                    toRet = toRet + "X";
                }
            }
            if (press(toRet + "B") == n)
            {
                return toRet + "B";
            }
            if (press(toRet + "X") == n)
            {
                return toRet + "X";
            }            
            return toRet + "A";
        }
    }
}

Compilation message (stderr)

combo.cpp:2:1: error: 'include' does not name a type
    2 | include "combo.h"
      | ^~~~~~~
combo.cpp:5:1: error: 'string' does not name a type; did you mean 'stdin'?
    5 | string guess_sequence(int n) {
      | ^~~~~~
      | stdin