This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define REP(v, i, j) for (int v = i; v < j; v++)
#define FORI(v) for (auto i : v)
#define FORJ(v) for (auto j : v)
#define OUT(v, a) FORI(v) cout << i << a;
#define OUTS(v, a, b) cout << v.size() << a; OUT(v, b)
#define in(a, n) REP(i, 0, n) cin >> a[i];
#define SORT(v) sort(begin(v), end(v))
#define REV(v) reverse(begin(v), end(v))
#define pb push_back
#define fi first
#define se second
#define detachIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<pii, pii> piiii;
//#define DEBUG
int c[300][300];
int ans[300];
int t[10] = {0, 1, 2, 1, 3, 2};
int query(int x, int y)
{
#ifndef DEBUG
if (c[x][y] != 0)
return c[x][y];
cout << (y - x + 1);
REP(i, x, y + 1)
cout << ' ' << i;
cout << endl;
int resp;
cin >> resp;
c[x][y] = resp;
return resp;
#else
set<int> st;
REP(i, x, y + 1)
st.insert(t[i]);
return st.size();
#endif
}
int main()
{
int n;
cin >> n;
ans[1] = 1;
int alloc = 2;
REP(i, 2, n + 1)
{
int x = -1;
int L = 1, R = i - 1;
while (L <= R)
{
int mid = (L + R) / 2;
if (query(mid, i - 1) == query(mid, i))
x = mid, L = mid + 1;
else
R = mid - 1;
}
if (x > 0)
ans[i] = ans[x];
else
ans[i] = alloc++;
}
cout << 0;
REP(i, 1, n + 1)
cout << ' ' << ans[i];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |