QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#190420 | #3675. Interactive Array Guessing | IsaacMoris# | WA | 1ms | 3576kb | C++17 | 1.6kb | 2023-09-28 20:41:07 | 2023-09-28 20:41:08 |
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;
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