Submission #344931

#TimeUsernameProblemLanguageResultExecution timeMemory
344931AlmaCombo (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);
        }
    }    
    for (int i = 2; i <= N; i++) {
        for (int j = 0; j < buttons.size(); j++) {
            if (press(S + buttons[j]) == i) {S += buttons[j];}
        }
    }
    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++) {
      |                     ~~^~~~~~~~~~~~~~~~
combo.cpp:18:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |         for (int j = 0; j < buttons.size(); j++) {
      |                         ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...