QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#844026#3675. Interactive Array GuessingthangthangWA 1ms3544kbC++201.1kb2025-01-05 12:04:542025-01-05 12:04:54

Judging History

This is the latest submission verdict.

  • [2025-01-05 12:04:54]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3544kb
  • [2025-01-05 12:04:54]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 1005;

int used[N];

int main(){
    int n; cin >> n;
    vector <int> ans;
    cout << "? " << n << ' ';
    for (int i = 1; i <= n / 2; ++ i) cout << i << ' ' << i << ' ';
    if (n & 1) cout << n / 2 + 1 << ' ';
    cout << endl;
    int k; cin >> k;
    while (k --){
        int a; cin >> a;
        ans.push_back(a);
    }

    cout << "? " << n << ' ';
    int be = n / 2 + 1;
    if (n & 1) {
        cout << n / 2 + 1 << ' ';
        be ++;
    }
    for (int i = be; i <= n; ++ i) cout << i << ' ' << i << ' ';
    cout << endl;
    cin >> k;
    while (k --){
        int a; cin >> a;
        ans.push_back(a);
    }


    cout << "! ";
    vector <int> arr;
    for (int id = 0; id < ans.size(); ++ id){
        int u = ans[id];
        if (used[u]){
            cout << arr.size() << ' ';
            for (int a : arr) cout << a << ' ';
            for (int i = 0; i < N; ++ i) used[i] = 0;
            id += arr.size() - 1;
        }
        else{
            arr.push_back(u);
            used[u] = 1;
        }
    }

    cout << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
4 1 1 1 2
6 1 2 2 1 2 1

output:

? 3 1 1 2 
? 3 2 3 3 
! 1 1 3 1 1 2 5 1 1 2 1 2 

result:

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