代码
# pragma GCC optimize("Ofast,no-stack-protector")
# pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
int t, n, x, a[205], s[15], now[15], g, ans;
vector <int> v;
int main () {
ios::sync_with_stdio (0);
cin.tie (0);
cout.tie (0);
cin >> t;
while (t --) {
cin >> n;
memset (s, 0, sizeof s);
for (int i = 1; i <= n; ++ i)
cin >> x, ++ s[x];
ans = g = 0;
while (! g) {
cout << "- 0" << endl;
memset (now, 0, sizeof now);
for (int i = 1; i <= n; ++ i)
cin >> a[i], ++ now[a[i]];
for (int i = 1; i < 10; ++ i)
if (now[i] > s[i]) {
g = i;
break ;
}
}
v.clear ();
for (int i = 1; i <= n; ++ i)
if (a[i] != g)
v.emplace_back (i);
cout << "- " << v.size () << ' ';
for (int& i : v)
cout << i << ' ';
cout << endl;
n = now[g];
// cerr << "size:" << n << '\n';
while (! ans) {
cout << "- 0" << endl;
for (int i = 1; i <= n; ++ i) {
cin >> x;
if (x != g)
ans = i;
}
}
cout << "! " << ans << endl;
}
return 0;
}