QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#190147#3675. Interactive Array GuessingBeevo#WA 1ms3816kbC++201.8kb2023-09-28 13:41:512023-09-28 13:41:52

Judging History

This is the latest submission verdict.

  • [2023-09-28 13:41:52]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3816kb
  • [2023-09-28 13:41:51]
  • Submitted

answer

#include <bits/stdc++.h>

#define el '\n'
#define Beevo ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef long double ld;

using namespace std;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

void testCase() {
    int n;
    cin >> n;

    int m = n - (n & 1);

    cout << "? " << m << ' ';

    for (int i = 1; i <= m / 2; i++)
        cout << i << ' ';

    for (int i = m / 2; i >= 1; i--)
        cout << i << ' ';

    cout << endl;

    int x;
    cin >> x;

    int a[x + 1];
    for (int i = 1; i <= x; i++)
        cin >> a[i];

    vector<int> sol[n + 1];

    for (int i = 1, l = 1, r = x; i <= m / 2; i++) {
        int y = a[r];

        while (a[l] != y)
            sol[i].push_back(a[l]), l++, r--;

        sol[i].push_back(a[l]);

        l++, r--;
    }

    cout << "? " << m << ' ';

    for (int i = m / 2 + 1; i <= m; i++)
        cout << i << ' ';

    for (int i = m; i >= m / 2 + 1; i--)
        cout << i << ' ';

    cout << endl;

    cin >> x;

    int b[x + 1];
    for (int i = 1; i <= x; i++)
        cin >> b[i];

    for (int i = m / 2 + 1, l = 1, r = x; i <= m; i++) {
        int y = b[r];

        while (b[l] != y)
            sol[i].push_back(b[l]), l++, r--;

        sol[i].push_back(b[l]);

        l++, r--;
    }

    if (n & 1) {
        cout << "? " << 1 << ' ' << n << endl;

        cin >> x;

        sol[n].resize(x);

        for (auto &i: sol[n])
            cin >> i;
    }

    cout << "! ";

    for (int i = 1; i <= n; i++) {
        cout << sol[i].size() << ' ';

        for (auto &j: sol[i])
            cout << j << ' ';
    }

    cout << endl;
}

signed main() {
    Beevo

    int t = 1;
//    cin >> t;

    while (t--)
        testCase();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3628kb

input:

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

output:

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

result:

ok 3 arrays, sum_len = 5

Test #2:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

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

output:

? 2 1 1 
? 2 2 2 
? 1 3
! 2 2 3 1 2 3 1 4 2 

result:

ok 3 arrays, sum_len = 6

Test #3:

score: 0
Accepted
time: 0ms
memory: 3792kb

input:

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

output:

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

result:

ok 3 arrays, sum_len = 6

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 3816kb

input:

1

output:

? 0 

result:

wrong answer asked 0 arrays, not in range [1..1]