QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#61081 | #3675. Interactive Array Guessing | abdelrahman001# | WA | 5ms | 5700kb | C++20 | 1.2kb | 2022-11-09 20:12:33 | 2022-11-09 20:12:36 |
Judging History
answer
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
using namespace std;
const int N = 1e5 + 5;
int n;
vector<int> ans[N];
void ask(int l, int r) {
cout << "? " << (r - l + 1) * 2;
for(int i = l;i <= r;i++)
cout << " " << i << " " << i;
cout << endl;
int k;
cin >> k;
vector<int> tmp;
set<int> st;
int cur = l;
for(int i = 0;i < k;i++) {
int x;
cin >> x;
if(st.count(x)) {
ans[cur] = tmp;
cur++;
for(int j = 1;j < tmp.size();j++)
cin >> x;
i += tmp.size() - 1;
st.clear();
tmp.clear();
} else {
st.insert(x);
tmp.push_back(x);
}
}
}
void answer() {
cout << "!";
for(int i = 1;i <= n;i++) {
cout << " " << ans[i].size();
for(auto j : ans[i])
cout << " " << j;
}
cout << endl;
}
int main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n;
if(n == 1) {
ask(1, 1);
answer();
return 0;
}
ask(1, n / 2);
ask(n / 2 + 1, n - (n & 1));
if(n & 1)
ask(n, n);
answer();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 5ms
memory: 5700kb
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: 5ms
memory: 5644kb
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: 0ms
memory: 5632kb
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
Wrong Answer
time: 2ms
memory: 5644kb
input:
1
output:
? 2 1 1
result:
wrong answer asked 2 arrays, not in range [1..1]