Submission #417471

#TimeUsernameProblemLanguageResultExecution timeMemory
417471LouayFarahCombo (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "bits/stdc++.h"
#include "combo.h"

using namespace std;

int press(string p);
string guess_sequence(int n)
{
    string first = "A";
    if(press("A")==1)
        first = "A";
    if(press("B")==1)
        first = "A";
    if(press("X")==1)
        first = "X";
    if(press("Y")==1)
        first = "Y";

    string res = first;
    ll curr = 1;

    vector<string> used;
    if(first!="A")
        used.pb("A");
    if(first!="B")
        used.pb("B");
    if(first!="X")
        used.pb("X");
    if(first!="Y")
        used.pb("Y");

    while(curr<n)
    {
        for(int i = 0; i<3; i++)
        {
            string temp = "";
            for(int j = 0; j<n-curr; j++)
            {
                temp+=used[j];
            }
            string s = res + temp;
            int nb = press(s);
            if(nb>curr)
            {
                for(int j = curr; j<nb; j++)
                {
                    res.pb(s[j]);
                }
                curr = nb;
                break;
            }
        }
    }
    
    return res;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:20:5: error: 'll' was not declared in this scope
   20 |     ll curr = 1;
      |     ^~
combo.cpp:24:14: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'pb'
   24 |         used.pb("A");
      |              ^~
combo.cpp:26:14: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'pb'
   26 |         used.pb("B");
      |              ^~
combo.cpp:28:14: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'pb'
   28 |         used.pb("X");
      |              ^~
combo.cpp:30:14: error: 'class std::vector<std::__cxx11::basic_string<char> >' has no member named 'pb'
   30 |         used.pb("Y");
      |              ^~
combo.cpp:32:11: error: 'curr' was not declared in this scope
   32 |     while(curr<n)
      |           ^~~~
combo.cpp:47:25: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'pb'
   47 |                     res.pb(s[j]);
      |                         ^~