제출 #96082

#제출 시각아이디문제언어결과실행 시간메모리
96082bogdan10bosCombo (IOI18_combo)C++14
5 / 100
2 ms328 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

const char ltr[] = {'A', 'B', 'X', 'Y'};
vector<char> can[2005];

string guess_sequence(int N)
{
    char start = 0;
    if(press("AB"))
    {
        if(press("A"))  start = 'A';
        else    start = 'B';
    }
    else
    {
        if(press("X"))  start = 'X';
        else    start= 'Y';
    }

    string pfx = "";
    pfx += start;

    vector<char> l;
    for(int i = 0; i < 4; i++)
        if(ltr[i] != start) l.push_back(ltr[i]);
    for(int i = 1; i + 1 < N; i++)
    {
        string qry = (pfx + l[0]) + (pfx + l[1] + l[0]) + (pfx + l[1] + l[1]) + (pfx + l[1] + l[2]);
        int prs = press(qry);
        if(prs == pfx.size())    pfx += l[2];
        else if(prs == pfx.size() + 1)   pfx += l[0];
        else    pfx += l[1];
    }

    if(press(pfx + l[0] + pfx + l[1]) == pfx.size())  pfx += l[2];
    else
    {
        if(press(pfx + l[0]) == pfx.size()) pfx += l[1];
        else    pfx += l[0];
    }

    return pfx;
}

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         if(prs == pfx.size())    pfx += l[2];
      |            ~~~~^~~~~~~~~~~~~
combo.cpp:34:21: 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(prs == pfx.size() + 1)   pfx += l[0];
      |                 ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:38:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     if(press(pfx + l[0] + pfx + l[1]) == pfx.size())  pfx += l[2];
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
combo.cpp:41:30: 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(pfx + l[0]) == pfx.size()) pfx += l[1];
      |            ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...