Submission #478247

#TimeUsernameProblemLanguageResultExecution timeMemory
478247ColourAttilaCombo (IOI18_combo)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include<combo.h>
using namespace std;

string guess_sequence(int N)
{
    string mo = "";
    int first = press("AB"), second;

    if(first) {
        second = press("A");
        if(second) mo = "A";
        else mo = "B";
    }
    else {
        second = press("X");
        if(second) mo = "X";
        else mo = "Y";
    }

    if(N == 1) return mo;

    string elements = "ABXY";
    vector<char> characters;
    for(char c : elements) {
        if(c != mo[0]) character.push_back(c);
    }

    for(int i = 1; i < N-1; i++) {
        string temp = "";
        temp += mo + characters[0] + characters[0];
        temp += mo + characters[0] + characters[1];
        temp += mo + characters[0] + characters[2];
        temp += mo + characters[1];

        int ans = press(temp);
        if(ans == i) {
            mo += characters[2];
        }
        else if(ans == i+1) {
            mo += characters[1];
        }
        else {
            mo += characters[0];
        }
    }

    bool b = false;
    for(int i = 0; i < 2; i++) {
        int temp = press(mo + character[i]);
        if(temp == N) {
            b = true;
            mo += character[i];
        }
    }

    if(b) mo += character[2];

    return mo;
}

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:26:24: error: 'character' was not declared in this scope; did you mean 'std::filesystem::file_type::character'?
   26 |         if(c != mo[0]) character.push_back(c);
      |                        ^~~~~~~~~
      |                        std::filesystem::file_type::character
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from combo.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:77:18: note: 'std::filesystem::file_type::character' declared here
   77 |       block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
      |                  ^~~~~~~~~
combo.cpp:50:31: error: 'character' was not declared in this scope; did you mean 'std::filesystem::file_type::character'?
   50 |         int temp = press(mo + character[i]);
      |                               ^~~~~~~~~
      |                               std::filesystem::file_type::character
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from combo.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:77:18: note: 'std::filesystem::file_type::character' declared here
   77 |       block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
      |                  ^~~~~~~~~
combo.cpp:57:17: error: 'character' was not declared in this scope; did you mean 'std::filesystem::file_type::character'?
   57 |     if(b) mo += character[2];
      |                 ^~~~~~~~~
      |                 std::filesystem::file_type::character
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from combo.cpp:1:
/usr/include/c++/10/bits/fs_fwd.h:77:18: note: 'std::filesystem::file_type::character' declared here
   77 |       block = 4, character = 5, fifo = 6, socket = 7, unknown = 8
      |                  ^~~~~~~~~