Submission #885788

#TimeUsernameProblemLanguageResultExecution timeMemory
885788sq00콤보 (IOI18_combo)C++14
10 / 100
27 ms1212 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];
            if(press(test) == test.size()) {
                current = test;
                break;
            }
        }
        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:28:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |             if(press(test) == test.size()) {
      |                ~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:33:27: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |         if(current.size() == N) break;
      |            ~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...