Submission #572045

#TimeUsernameProblemLanguageResultExecution timeMemory
572045il9Combo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
//coding template
#include <bits/stdc++.h>
using ll =long long;
using namespace std;

string guess_sequence(int n)
{

    string s;
    char f;
    long long temp=0;
    temp=press("XY");
    string no;
    if(temp==2)
    {
        f='X';
        no="YBA";
    }else if(temp==1)
    {
        temp=press("X");
        if(temp)
        {
            f='X';
            no="YBA";
        }else
        {
            f='Y';
            no="XBA";
        }
    }else
    {
        temp=press("B");
        if(temp)
        {
            f='B';
            no="XYA";
        }else
        {
            f='A';
            no="YXB";
        }
    }


    s=f;
    for(int i=0;i<n-1;i++)
    {
        temp=press(s+no[0]+s+no[1]+no[0]+s+no[1]+no[1]+s+no[1]+no[2]);
        if(temp==s.size()+1)
        {
            s+=no[0];
        }else if(temp==s.size())
        {
            s+=no[2];
        }else
        {
            s+=no[1];
        }
    }
    temp=press(s+no[0]+s+no[1]);
    if(temp==s.size())
    {
        s+=no[2];
    }else
    {
        temp=press(s+no[0]);
        if(temp==s.size()+1)
        {
            s+=no[0];
        }else
        {
            s+=no[1];
        }
    }
    return s;

}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:12:10: error: 'press' was not declared in this scope
   12 |     temp=press("XY");
      |          ^~~~~
combo.cpp:49:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |         if(temp==s.size()+1)
      |            ~~~~^~~~~~~~~~~~
combo.cpp:52:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         }else if(temp==s.size())
      |                  ~~~~^~~~~~~~~~
combo.cpp:61:12: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |     if(temp==s.size())
      |        ~~~~^~~~~~~~~~
combo.cpp:67:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   67 |         if(temp==s.size()+1)
      |            ~~~~^~~~~~~~~~~~