#include "dango3.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a; i<=b; i++)
int qry(vector<int> v){
cout << "? ";
for(int x:v) cout << x << " ";
cout << endl;
int ret; cin >> ret;
return ret;
}
void ans(vector<int> v){
cout << "! ";
for(int x:v) cout << x << " ";
cout << endl;
}
vector<vector<int>> dango;
int ki[100000];
int it;
void solve(int l, int r, int li, int ri){
if(r<l) return;
int m=(l+r)/2;
int p=li-1;
auto ck=[&](int p)->bool{
// cout << "try " << p << endl;
vector<int> qu;
for(int i=0; i<=p; i++){
// cout << "ki[" << i << "] " << ki[i] << "\n";
if(ki[i] && ki[i]<it) continue;
qu.push_back(i);
}
for(int i=0; i<m; i++){
for(int x:dango[i]) qu.push_back(x);
}
return Query(qu)<m;
};
for(int k=31-__builtin_clz(ri-li+1); k>=0; k--){
if(p+(1<<k)<ri && ck(p+(1<<k))) p+=(1<<k);
}
p++;
ki[p]=it;
// cout << "ki " << p << " = " << it << endl;
solve(l, m-1, li, p-1);
solve(m+1, r, p, ri);
}
void Solve(int n, int m) {
dango.resize(m);
for(it=1; it<=n; it++){
solve(1, m, 0, n*m-1);
int j=0;
for(int i=0; i<n*m; i++){
if(ki[i]==it){
dango[j++].push_back(i+1);
}
}
}
for(int i=0; i<m; i++) Answer(dango[i]);
}
// int main(){
// Solve(3, 2);
// }
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
324 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
468 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |