#include "dango3.h"
#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;
}
void Solve(int n, int m)
{
int i, j, k, tot=0;
for (i=1; i <= n*m; ++i)
{
int lb = 1, ub = tot + 1, mid;
while (lb < ub)
{
mid = (lb + ub) >> 1;
if (chk(mid, i)) ub = mid;
else lb = mid + 1;
}
//cout << "lb = " << lb << "\n\n";
tot = max(tot, lb);
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 'void Solve(int, int)':
dango3.cpp:64:15: warning: unused variable 'k' [-Wunused-variable]
64 | int i, j, k, tot=0;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |