Submission #885789

#TimeUsernameProblemLanguageResultExecution timeMemory
885789sq00콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "combo.h"

using namespace std;

string guess_sequence(int N) {
  string buttons = "", firstBtn = "";
    if(press("A") == 1) {
        firstBtn = "A";
        buttons = "BYX";
    }
    else if(press("B") == 1) {
        firstBtn = "B";
        buttons = "AYX";
    }
    else if(press("Y") == 1) {
        firstBtn = "Y";
        buttons = "ABX";
    }
    else if(press("X") == 1) {
        firstBtn = "X";
        buttons = "ABY";
    }
    string current = firstBtn;
    while(true) {
        for(int i = 0; i < buttons.size(); i++) {
            string test = current + buttons[i];
            int cost = press(test);
            if(cost == test.size()) {
                current = test;
                break;
            }
            if(i == 1) current += buttons[2];
        }
        if(current.size() == n) break;
    }
    return current;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int i = 0; i < buttons.size(); i++) {
      |                        ~~^~~~~~~~~~~~~~~~
combo.cpp:29:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |             if(cost == test.size()) {
      |                ~~~~~^~~~~~~~~~~~~~
combo.cpp:35:30: error: 'n' was not declared in this scope
   35 |         if(current.size() == n) break;
      |                              ^