#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);
}
for(int &x:qu) 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);
}
}
}
for(int i=0; i<m; i++){
for(int &x:dango[i]) x++;
Answer(dango[i]);
}
}
// int main(){
// Solve(3, 2);
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
312 KB |
Output is correct |
4 |
Correct |
0 ms |
308 KB |
Output is correct |
5 |
Correct |
0 ms |
312 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
376 KB |
Output is correct |
2 |
Correct |
50 ms |
356 KB |
Output is correct |
3 |
Correct |
39 ms |
340 KB |
Output is correct |
4 |
Correct |
39 ms |
340 KB |
Output is correct |
5 |
Correct |
48 ms |
316 KB |
Output is correct |
6 |
Correct |
49 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1324 ms |
484 KB |
Output is correct |
2 |
Correct |
1335 ms |
496 KB |
Output is correct |
3 |
Correct |
690 ms |
500 KB |
Output is correct |
4 |
Correct |
711 ms |
500 KB |
Output is correct |
5 |
Correct |
1206 ms |
496 KB |
Output is correct |
6 |
Correct |
1198 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2700 ms |
688 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |