Submission #203584

#TimeUsernameProblemLanguageResultExecution timeMemory
203584TadiornCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;
int press(string a)
{

}

string guess_sequence(int N)
{
    string f;
    int te = press("AB");
    if(te >= 1)
    {
        te = press("A");
        if(te == 1)
        {
            f = "A";
        }
        else
        {
            f = "B";
        }
    }
    else
    {
        te = press("X");
        if(te == 1)
        {
            f = "X";
        }
        else
        {
            f = "Y";
        }
    }

    if(f == "A")
    {
        for(int i = 1; i < N - 1; i++)
        {
            int t = press(f + "X"+ f + "YB" + f + "YX" + f + "YY");
            if(t == f.size())
            {
                f += "B";
            }
            else if(t == f.size() + 1)
            {
                f += "X";
            }
            else //if(t == s.size() + 2)
            {
                f += "Y";
            }
        }
    }
    else if(f == "B")
    {
        int t = press(f + "X"+ f + "YA" + f + "YX" + f + "YY");
        if(t == f.size())
        {
            f += "A";
        }
        else if(t == f.size() + 1)
        {
            f += "X";
        }
        else //if(t == s.size() + 2)
        {
            f += "Y";
        }
    }
    else if(f == "X")
    {
        int t = press(f + "A"+ f + "BA" + f + "BB" + f + "BY");
        if(t == f.size())
        {
            f += "Y";
        }
        else if(t == f.size() + 1)
        {
            f += "A";
        }
        else //if(t == s.size() + 2)
        {
            f += "B";
        }
    }
    else //if(f == "Y")
    {
        int t = press(f + "A"+ f + "BA" + f + "BB" + f + "BX");
        if(t == f.size())
        {
            f += "X";
        }
        else if(t == f.size() + 1)
        {
            f += "A";
        }
        else //if(t == s.size() + 2)
        {
            f += "B";
        }
    }

    te = press("AB");
    if(te >= 1)
    {
        te = press("A");
        if(te == 1)
        {
            f = "A";
        }
        else
        {
            f = "B";
        }
    }
    else
    {
        te = press("X");
        if(te == 1)
        {
            f = "X";
        }
        else
        {
            f = "Y";
        }
    }

    return f;
}

/*
int main()
{

    return 0;
}*/

Compilation message (stderr)

combo.cpp: In function 'int press(std::string)':
combo.cpp:7:1: warning: no return statement in function returning non-void [-Wreturn-type]
    7 | }
      | ^
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:43:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             if(t == f.size())
      |                ~~^~~~~~~~~~~
combo.cpp:47:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |             else if(t == f.size() + 1)
      |                     ~~^~~~~~~~~~~~~~~
combo.cpp:60:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |         if(t == f.size())
      |            ~~^~~~~~~~~~~
combo.cpp:64:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |         else if(t == f.size() + 1)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:76:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   76 |         if(t == f.size())
      |            ~~^~~~~~~~~~~
combo.cpp:80:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 |         else if(t == f.size() + 1)
      |                 ~~^~~~~~~~~~~~~~~
combo.cpp:92:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   92 |         if(t == f.size())
      |            ~~^~~~~~~~~~~
combo.cpp:96:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   96 |         else if(t == f.size() + 1)
      |                 ~~^~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccgsSVcM.o: in function `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
grader.cpp:(.text+0x0): multiple definition of `press(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'; /tmp/ccVybv6K.o:combo.cpp:(.text.unlikely+0x0): first defined here
collect2: error: ld returned 1 exit status