Submission #345475

#TimeUsernameProblemLanguageResultExecution timeMemory
345475AlmaCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include <iostream>
#include <vector>
#include <string>
#include <combo.h>
using namespace std;

string guess_sequence(int N) {
    string S = "";
    vector<char> buttons = {'A', 'B', 'X', 'Y'};

    for (int i = 0; i < buttons.size(); i++) {
        if (press(S + buttons[i]) == 1) {
            S += buttons[i];
            buttons.erase(buttons.begin()+i);
        }
    }
    if (N == 1) {return S;}
    
    for (int j = 2; j <= N; j++) {
        for (char c: buttons) {
            if (press(S + c) == j) {S += c;}
        }
    }
    return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0; i < buttons.size(); i++) {
      |                     ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...