Language: C++

// https://atcoder.jp/contests/ddcc2020-qual/tasks/ddcc2020_qual_e
#define CIN_ONLY
#define DECIMAL_DIGITS 10
#define STATIC_MOD 1e9 + 7

#ifdef BTK
/*<head>*/
#    include "Template.hpp"
/*</head>*/
#else
/*<body>*/
/*</body>*/
#endif

constexpr int RED  = 0;
constexpr int BLUE = 1;
int N;
#ifdef BTK
string ball[1000];
#endif

void init() {
#ifdef BTK
    N = 21;
    for (int i : range(N)) {
        ball[i]     = "R";
        ball[i + N] = "B";
    }
    random_shuffle(ball, ball + N + N);
    cerr << "N=" << N << endl;
    for (int i : range(N)) {
        cerr << ball[i] << "";
    }
    cerr << endl;
#else
    cin >> N;
#endif
}

int query(vector<int> v) {
    stringstream ss;
    ss << "?";
    for (auto it : v) ss << " " << it + 1;
    string s = ss.str();
    cout << s << endl;
    cout.flush();
#ifdef BTK
    map<string, int> x;
    for (auto it : v) {
        x[ball[it]]++;
    }
    if (x["R"] > x["B"])
        s = "R";
    else
        s = "B";
    cerr << "ans:" << s << endl;
#else
    cin >> s;

#endif
    return s[0] == 'R' ? RED : BLUE;
}


pair<int, int> first() {
    int pre = -1;
    for (int i : range(N + 1)) {
        vector<int> q;
        for (int j : range(N)) {
            q.push_back(i + j);
        }
        int cur = query(q);
        if (pre != -1 && pre != cur) {
            return {i, cur};
        }
        pre = cur;
    }
    assert(false);
    return {0, 0};
}

int ret[1000];

void out() {
    for (int i : range(N * 2)) {
        cout << "RB"[ret[i]];
    }
    cout << endl;

#ifdef BTK
    for (int i : range(N * 2)) {
        cerr << ball[i][0];
    }
    cerr << endl;
    for (int i : range(N * 2)) {
        assert("RB"[ret[i]] == ball[i][0]);
    }
#endif
}

int main() {
    /* write here */
    init();
    int pos, col;
    tie(pos, col)    = first();
    int lb           = pos;
    int ub           = pos + N;
    ret[pos + N - 1] = col;
    {
        // [use](col)
        vector<int> use, target;
        for (int i : range(N * 2)) {
            if (lb <= i && i < ub - 1) {
                use.push_back(i);
            }
            if (i < lb || ub <= i) {
                target.push_back(i);
            }
        }
        for (auto p : target) {
            vector<int> check = use;
            check.push_back(p);
            ret[p] = query(check);
        }
    }
    {
        // [use](!col)XXXXX[use]
        vector<int> use, target;
        for (int i : range(N * 2)) {
            if (lb <= i && i < ub) {
                target.push_back(i);
            }
            if (i < lb - 1 || ub <= i) {
                use.push_back(i);
            }
        }
        for (auto p : target) {
            vector<int> check = use;
            check.push_back(p);
            ret[p] = query(check);
        }
    }
    out();
    return 0;
}

Compiler output:
a.cc: In function 'void init()':
a.cc:36:5: error: 'cin' was not declared in this scope
   36 |     cin >> N;
      |     ^~~
a.cc: At global scope:
a.cc:40:11: error: 'vector' was not declared in this scope
   40 | int query(vector<int> v) {
      |           ^~~~~~
a.cc:40:18: error: expected primary-expression before 'int'
   40 | int query(vector<int> v) {
      |                  ^~~
a.cc:65:1: error: 'pair' does not name a type
   65 | pair<int, int> first() {
      | ^~~~
a.cc: In function 'void out()':
a.cc:85:18: error: 'range' was not declared in this scope
   85 |     for (int i : range(N * 2)) {
      |                  ^~~~~
a.cc:86:9: error: 'cout' was not declared in this scope; did you mean 'out'?
   86 |         cout << "RB"[ret[i]];
      |         ^~~~
      |         out
a.cc:88:5: error: 'cout' was not declared in this scope; did you mean 'out'?
   88 |     cout << endl;
      |     ^~~~
      |     out
a.cc:88:13: error: 'endl' was not declared in this scope
   88 |     cout << endl;
      |             ^~~~
a.cc: In function 'int main()':
a.cc:105:5: error: 'tie' was not declared in this scope
  105 |     tie(pos, col)    = first();
      |     ^~~
a.cc:105:24: error: 'first' was not declared in this scope
  105 |     tie(pos, col)    = first();
      |                        ^~~~~
a.cc:111:9: error: 'vector' was not declared in this scope
  111 |         vector<int> use, target;
      |         ^~~~~~
a.cc:111:16: error: expected primary-expression before 'int'
  111 |         vector<int> use, target;
      |                ^~~
a.cc:112:22: error: 'range' was not declared in this scope
  112 |         for (int i : range(N * 2)) {
      |                      ^~~~~
a.cc:114:17: error: 'use' was not declared in this scope
  114 |                 use.push_back(i);
      |                 ^~~
a.cc:117:17: error: 'target' was not declared in this scope
  117 |                 target.push_back(i);
      |                 ^~~~~~
a.cc:120:23: error: 'target' was not declared in this scope
  120 |         for (auto p : target) {
      |                       ^~~~~~
a.cc:121:20: error: expected primary-expression before 'int'
  121 |             vector<int> check = use;
      |                    ^~~
a.cc:122:13: error: 'check' was not declared in this scope
  122 |             check.push_back(p);
      |             ^~~~~
a.cc:123:27: error: 'query' cannot be used as a function
  123 |             ret[p] = query(check);
      |                      ~~~~~^~~~~~~
a.cc:128:9: error: 'vector' was not declared in this scope
  128 |         vector<int> use, target;
      |         ^~~~~~
a.cc:128:16: error: expected primary-expression before 'int'
  128 |         vector<int> use, target;
      |                ^~~
a.cc:129:22: error: 'range' was not declared in this scope
  129 |         for (int i : range(N * 2)) {
      |                      ^~~~~
a.cc:131:17: error: 'target' was not declared in this scope
  131 |                 target.push_back(i);
      |                 ^~~~~~
a.cc:134:17: error: 'use' was not declared in this scope
  134 |                 use.push_back(i);
      |                 ^~~
a.cc:137:23: error: 'target' was not declared in this scope
  137 |         for (auto p : target) {
      |                       ^~~~~~
a.cc:138:20: error: expected primary-expression before 'int'
  138 |             vector<int> check = use;
      |                    ^~~
a.cc:139:13: error: 'check' was not declared in this scope
  139 |             check.push_back(p);
      |             ^~~~~
a.cc:140:27: error: 'query' cannot be used as a function
  140 |             ret[p] = query(check);
      |                      ~~~~~^~~~~~~