Submission #1280816

#TimeUsernameProblemLanguageResultExecution timeMemory
1280816lalbertoo89Combo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
#include "combo.h"

string guess_sequence(int N){
    string buttons = "ABXY";
    string S = "";

    string first;
    for(char c : buttons){
        if(pSs(string(1, c)) > 0){
            first = c;
            break;
        }
    }
    string s1 = "";
    for(char c: buttons){
        if(c != S[0]) s1 += c;
    }

    int m = S.size();

    while(m < N){
        int k = S.size();

        string s2
        s2 += S + s1[0]+ s1[0];

        s2 += S + s1[0] + s1[1]; 

        s2 += S + s1[0] + s1[2];

        int luis = pSs(s2);

        if(luis == k) S += s1[2];
        else if(luis == k+1) S += s1[1];
        else S += s1[0];
    }

    if ((int)S.size() < N) {
        for(char c : s1) {
            if(pSs(S + c) == N) {
                S += c;
                break;
            }
        }
    }

    return S;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:12: error: 'pSs' was not declared in this scope
   11 |         if(pSs(string(1, c)) > 0){
      |            ^~~
combo.cpp:27:9: error: expected initializer before 's2'
   27 |         s2 += S + s1[0]+ s1[0];
      |         ^~
combo.cpp:29:9: error: 's2' was not declared in this scope; did you mean 's1'?
   29 |         s2 += S + s1[0] + s1[1];
      |         ^~
      |         s1
combo.cpp:33:20: error: 'pSs' was not declared in this scope
   33 |         int luis = pSs(s2);
      |                    ^~~
combo.cpp:42:16: error: 'pSs' was not declared in this scope
   42 |             if(pSs(S + c) == N) {
      |                ^~~