Submission #79477

#TimeUsernameProblemLanguageResultExecution timeMemory
79477alextodoranCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string b[] = {"A", "B", "X", "Y"};
vector <string> b1;

string guess_sequence(int N)
{
    string pref = "";
    if(press("AX"))
    {
        if(press("A"))
            pref = "A";
        else
            pref = "X";
    }
    else
    {
        if(press("B"))
            pref = "B";
        else
            pref = "Y";
    }
    for(int i = 0; i < 4; i++)
        if(b[i] != pref)
            b1.push_back(b[i]);
    for(int i = 1; i < N - 1; i++)
    {
        int q = press(pref + b1[0] + pref + b1[1] + b1[0] + pref + b1[1] + b1[1] + pref + b1[1] + b1[2]);
        if(q == pref.size())
            pref += b1[2];
        else if(q == pref.size() + 1)
            pref += b1[0];
        else
            pref += b1[1];
    }
    if(press(pref + b1[0] + pref + b1[1]) > pref.size())
    {
        if(press(pref + b1[0]) > pref.size())
            pref += b1[0];
        else
            pref += b1[1];
    }
    else
        pref += b1[2];
    return pref;
}

int main()
{
    return 0;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         if(q == pref.size())
      |            ~~^~~~~~~~~~~~~~
combo.cpp:34:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         else if(q == pref.size() + 1)
      |                 ~~^~~~~~~~~~~~~~~~~~
combo.cpp:39:43: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |     if(press(pref + b1[0] + pref + b1[1]) > pref.size())
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:41:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         if(press(pref + b1[0]) > pref.size())
      |            ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccfvw8zM.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccNrS9mO.o:combo.cpp:(.text.startup+0xc0): first defined here
collect2: error: ld returned 1 exit status