#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define bug(x) cerr << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)(v).size()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
//#define TEST
const int N = 50;
const int Mxm = 10005;
const int INF = 2e9;
int n, m;
bool inq[Mxm];
vector<int> v[N], pre[N], tmp;
#ifdef TEST
int a[N], cnt[N];
inline int Query(vector<int> &v)
{
cout << "? ";
for (int x : v) cout << x << ' '; cout << '\n';
int mn = INF;
for (int i=1; i <= n; ++i) cnt[i] = 0;
for (int x : v) ++cnt[a[x]];
for (int i=1; i <= n; ++i) mn = min(mn, cnt[i]);
int ret = mn;
cout << "ret = " << ret << '\n';
return ret;
}
inline void Answer(vector<int> &v)
{
cout << "! ";
for (int x : v) cout << x << ' '; cout << '\n';
}
#endif
inline bool chk(int id, int del_id)
{
for (int i=1; i <= n*m; ++i) inq[i] = 1;
inq[del_id] = 0;
for (int x : pre[id]) inq[x] = 0;
tmp.clear();
for (int i=1; i <= n*m; ++i) if (inq[i]) tmp.pb(i);
int ret = Query(tmp);
return ret == m - id;
}
inline void Solve(int n, int m)
{
int i, j, k;
for (i=1; i <= n*m; ++i)
{
int lb = 1, ub = m, mid;
while (lb < ub)
{
mid = (lb + ub) >> 1;
if (chk(mid, i)) ub = mid;
else lb = mid + 1;
}
v[lb].pb(i);
for (j=lb; j <= m; ++j) pre[j].pb(i);
}
for (i=1; i <= m; ++i) Answer(v[i]);
}
#ifdef TEST
int main(void)
{ IO
int i;
cin >> n >> m;
for (i=1; i <= n*m; ++i) cin >> a[i];
Solve(n, m);
return 0;
}
#endif
Compilation message
dango3.cpp: In function 'bool chk(int, int)':
dango3.cpp:57:15: error: 'Query' was not declared in this scope
57 | int ret = Query(tmp);
| ^~~~~
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:78:28: error: 'Answer' was not declared in this scope
78 | for (i=1; i <= m; ++i) Answer(v[i]);
| ^~~~~~
dango3.cpp:63:15: warning: unused variable 'k' [-Wunused-variable]
63 | int i, j, k;
| ^