ILE
查看原帖
ILE
637788
kimi0705楼主2023/12/18 22:00

ILE

#include <bits/stdc++.h>
using namespace std;
const int N = 20;
int t;
int n, x;
vector<int> arr, now(N), Last(N), zero(N, 0);
int find() {
    int flag = -1;
    while (1) {
        cout << "- 0" << endl;
        cout.flush();
        for (int& i : arr) {
            cin >> i;
            now[i]++;
        }
        if (now != Last) break;
        now = zero;
    }
    for (int i = 0; i < N; i++)
        if (now[i] == Last[i] + 1) {
            flag = i;
            break;
        }
    return flag;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> t;
    while (t--) {
        cin >> n;
        now = zero;
        arr.resize(n);
        for (int& i : arr) {
            cin >> i;
            now[i]++;
        }
        Last = now;
        now = zero;

        int flag = find(), del_cnt = 0;

        for (int i = 0; i < n; i++)
            if (arr[i] != flag)
                del_cnt++;
        cout << "- " << del_cnt << ' ';
        for (int i = 0; i < n; i++)
            if (arr[i] != flag)
                cout << i + 1 << ' ';
        cout << endl;
        cout.flush();
        arr.resize(n - del_cnt);
        flag = find();
        for (int i = 0; i < n; i++)
            if (arr[i] == flag) {
                cout << "! " << i + 1 << endl;
                cout.flush();
            }
    }
}
2023/12/18 22:00
加载中...