QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#190407 | #3675. Interactive Array Guessing | IsaacMoris# | ML | 1ms | 3816kb | C++17 | 1.3kb | 2023-09-28 20:36:14 | 2024-01-17 03:30:18 |
Judging History
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;
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();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3600kb
input:
3 2 1 1 4 1 2 1 2 4 2 1 2 1
output:
? 2 1 1 ? 2 2 2 ? 2 3 3 ! 1 1 2 1 2 2 2 1
result:
ok 3 arrays, sum_len = 5
Test #2:
score: 0
Accepted
time: 1ms
memory: 3548kb
input:
3 4 2 3 2 3 2 2 2 6 1 4 2 1 4 2
output:
? 2 1 1 ? 2 2 2 ? 2 3 3 ! 2 2 3 1 2 3 1 4 2
result:
ok 3 arrays, sum_len = 6
Test #3:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
3 4 1 2 1 2 4 1 2 1 2 4 2 1 2 1
output:
? 2 1 1 ? 2 2 2 ? 2 3 3 ! 2 1 2 2 1 2 2 2 1
result:
ok 3 arrays, sum_len = 6
Test #4:
score: -100
Memory Limit Exceeded
input:
1
output:
? 2 1 1