File size: 2,039 Bytes
1fd0050
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include <bits/stdc++.h>
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int sub, n;
  cin >> sub >> n;
  // set S = {1}
  cout << 1 << " " << 1 << endl;
  cout.flush();
  int r0;
  cin >> r0;
  // find neighbors of 1
  vector<int> ops;
  for (int i = 1; i <= n; ++i) {
    if (i != 1) {
      ops.push_back(i);
      ops.push_back(i);
    }
  }
  int L = ops.size();
  cout << L;
  for (int u : ops) cout << " " << u;
  cout << endl;
  cout.flush();
  vector<int> res(L);
  for (int i = 0; i < L; ++i) cin >> res[i];
  vector<int> neigh;
  for (int i = 0; i < L; i += 2) {
    if (res[i] == 1) neigh.push_back(ops[i]);
  }
  assert(neigh.size() == 2);
  int a = neigh[0];
  int b = neigh[1];
  // set S = {a}
  cout << 2 << " " << 1 << " " << a << endl;
  cout.flush();
  vector<int> res_set(2);
  for (int &x : res_set) cin >> x;
  // now S = {a}
  vector<int> perm;
  perm.push_back(1);
  perm.push_back(a);
  vector<int> rem;
  for (int i = 1; i <= n; ++i) {
    if (i != 1 && i != a) rem.push_back(i);
  }
  int current = a;
  while (!rem.empty()) {
    vector<int> ops_big;
    for (int c : rem) {
      ops_big.push_back(c);
      ops_big.push_back(c);
    }
    int Lb = ops_big.size();
    cout << Lb;
    for (int u : ops_big) cout << " " << u;
    cout << endl;
    cout.flush();
    vector<int> resb(Lb);
    for (int i = 0; i < Lb; ++i) cin >> resb[i];
    int next_c = -1;
    for (int i = 0; i < Lb; i += 2) {
      if (resb[i] == 1) {
        next_c = ops_big[i];
        break;
      }
    }
    assert(next_c != -1);
    auto it = find(rem.begin(), rem.end(), next_c);
    assert(it != rem.end());
    rem.erase(it);
    perm.push_back(next_c);
    // set S = {next_c}
    cout << 2 << " " << current << " " << next_c << endl;
    cout.flush();
    vector<int> res_next(2);
    for (int &x : res_next) cin >> x;
    current = next_c;
  }
  assert(perm.size() == (size_t)n);
  // output
  cout << -1;
  for (int p : perm) cout << " " << p;
  cout << endl;
  cout.flush();
  return 0;
}