Submission #217764

#TimeUsernameProblemLanguageResultExecution timeMemory
217764kkm0476콤보 (IOI18_combo)C++11
10 / 100
72 ms448 KiB
#include "combo.h"
#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;


string guess_sequence(int n) {
    string S;
    int x;
    if(press("A") == 1) S = "A", x = 0;
    else if(press("B") == 1) S = "B", x = 1;
    else if(press("X") == 1) S = "X", x = 2;
    else S = "Y", x = 3;
    while(S.size() < n) {
        if(x != 0 && press(S + "A") == S.size() + 1)
            S += "A";
        else if(x != 1 && press(S + "B") == S.size() + 1)
            S += "B";
        else if(x != 2 && press(S + "X") == S.size() + 1)
            S += "X";
        else
            S += "Y";
    }
    return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:16:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   16 |     while(S.size() < n) {
      |           ~~~~~~~~~^~~
combo.cpp:17:37: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         if(x != 0 && press(S + "A") == S.size() + 1)
      |                      ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:19:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |         else if(x != 1 && press(S + "B") == S.size() + 1)
      |                           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
combo.cpp:21:42: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         else if(x != 2 && press(S + "X") == S.size() + 1)
      |                           ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...