QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#844026 | #3675. Interactive Array Guessing | thangthang | WA | 1ms | 3544kb | C++20 | 1.1kb | 2025-01-05 12:04:54 | 2025-01-05 12:04:54 |
Judging History
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;
}
详细
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