제출 #873609

#제출 시각아이디문제언어결과실행 시간메모리
873609maxFedorchukCombo (IOI18_combo)C++14
0 / 100
0 ms600 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;

/*
int press(string p)
{
    return 1;
}
*/

string guess_sequence(int N)
{
    string alsym[4]={"a","b","x","y"};

    string pot[3];
    int frs;

    if(press(alsym[0]+alsym[1]))
    {
        if(press(alsym[0]))
        {
            frs=0;
            pot[0]="b";
            pot[1]="x";
            pot[2]="y";
        }
        else
        {
            frs=1;
            pot[0]="a";
            pot[1]="x";
            pot[2]="y";
        }
    }
    else
    {
        if(press(alsym[2]))
        {
            frs=2;
            pot[0]="a";
            pot[1]="b";
            pot[2]="y";
        }
        else
        {
            frs=3;
            pot[0]="a";
            pot[1]="b";
            pot[2]="x";
        }
    }

    string res=alsym[frs];

    for(int i=2;i<N;i++)
    {
        string zap=(res+pot[0]+pot[1])+(res+pot[0]+pot[2])+(res+pot[0]+pot[3])+(res+pot[1]+alsym[frs]);

        int rt=press(zap);

        if((res.size()+2)==rt)
        {
            res+=pot[0];
        }
        else
        {
            if((res.size()+1)==rt)
            {
                res+=pot[1];
            }
            else
            {
                res+=pot[2];
            }
        }
    }

    if(press(res+pot[0]+res+pot[1])==N)
    {
        if(press(res+pot[0])==N)
        {
            res+=pot[0];
        }
        else
        {
            res+=pot[1];
        }
    }
    else
    {
        res+=pot[2];
    }

    return res;
}
/*
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    string s;
    cin>>s;

    if(guess_sequence(s.size())==s)
    {
        cout<<"Ok\n";
    }
    else
    {
        cout<<"No\n";
    }

    return 0;
}
*/

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:62:26: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   62 |         if((res.size()+2)==rt)
      |            ~~~~~~~~~~~~~~^~~~
combo.cpp:68:30: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   68 |             if((res.size()+1)==rt)
      |                ~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...