QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#190420#3675. Interactive Array GuessingIsaacMoris#WA 1ms3576kbC++171.6kb2023-09-28 20:41:072023-09-28 20:41:08

Judging History

This is the latest submission verdict.

  • [2023-09-28 20:41:08]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3576kb
  • [2023-09-28 20:41:07]
  • Submitted

answer

#include<iostream>
#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 2e5 + 5;


vector<vector<int> > ans;

void solve(int l, int r) {
    if (l > r)return;
    if (l == r) {
        cout << "? " << 1 << " " << 1 << "\n";
        cout.flush();
        ans.push_back({});
        int sz;
        cin >> sz;
        while (sz--) {
            int x;
            cin >> x;
            ans.back().push_back(x);
        }
        return;
    }
    cout << "? " << 2 * (r - l + 1);
    for (int i = l; i <= r; i++) {
        cout << " " << i << " " << i;
    }
    cout << "\n";
    cout.flush();

    int sz;
    cin >> sz;
    set<int> vis;
    bool flag = false;
    while (sz--) {
        int x;
        cin >> x;
        if (vis.count(x) == 0) {
            vis.insert(x);
            flag = false;
        } else {
            if (!flag) {
                ans.push_back({});
                flag = true;
            }
            vis.erase(x);
            ans.back().push_back(x);
        }
    }
}

void doWork() {
    int n;
    cin >> n;
    solve(1, n / 2);
    solve(n / 2 + 1, n - 1);
    solve(n, n);

    cout << "! ";
    for (auto i: ans) {
        cout << i.size() << " ";
        for (auto j: i) {
            cout << j << " ";
        }
    }
    cout.flush();
}

int main() {
    //IO
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        //  cout << "Case #" << i << ": ";
        doWork();
    }
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3576kb

input:

3
1 1
1 1
1 1

output:

? 1 1
? 1 1
? 1 1
! 1 1 1 1 1 1 

result:

wrong answer Length of 2-th array differ: expected 2, found 1