Submission #928595

#TimeUsernameProblemLanguageResultExecution timeMemory
928595AtabayRajabli콤보 (IOI18_combo)C++17
10 / 100
47 ms1220 KiB
#include <bits/stdc++.h>
#include "combo.h"

std::string guess_sequence(int N)
{
    std::string s = "";
    std::string l = "ABXY";
    for(int i = 0; i < 4; i++)
    {
        s += l[i];
        if(press(s))break;
        s.pop_back();
    }

    for(int i = 2; i <= N; i++)
    {
        for(int j = 0; j < 4; j++)
        {
            std::string c = s;
            while(c.size() < N)c += l[j];
            if(press(c) > s.size())
            {
                s += l[j];
                break;
            }
        }
    }

    return s;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |             while(c.size() < N)c += l[j];
      |                   ~~~~~~~~~^~~
combo.cpp:21:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |             if(press(c) > s.size())
      |                ~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...