#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];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
16 ms |
504 KB |
Output is correct |
2 |
Correct |
15 ms |
368 KB |
Output is correct |
3 |
Correct |
16 ms |
420 KB |
Output is correct |
4 |
Correct |
13 ms |
324 KB |
Output is correct |
5 |
Correct |
16 ms |
328 KB |
Output is correct |
6 |
Correct |
13 ms |
436 KB |
Output is correct |
7 |
Correct |
15 ms |
372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
328 KB |
Output is correct |
2 |
Correct |
19 ms |
332 KB |
Output is correct |
3 |
Correct |
10 ms |
328 KB |
Output is correct |
4 |
Correct |
12 ms |
360 KB |
Output is correct |
5 |
Correct |
16 ms |
404 KB |
Output is correct |
6 |
Correct |
15 ms |
328 KB |
Output is correct |
7 |
Correct |
17 ms |
432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
328 KB |
Output is correct |
2 |
Correct |
13 ms |
364 KB |
Output is correct |
3 |
Correct |
19 ms |
424 KB |
Output is correct |
4 |
Correct |
14 ms |
356 KB |
Output is correct |
5 |
Correct |
16 ms |
404 KB |
Output is correct |
6 |
Correct |
18 ms |
424 KB |
Output is correct |
7 |
Correct |
10 ms |
420 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
440 KB |
Output is correct |
2 |
Correct |
19 ms |
388 KB |
Output is correct |
3 |
Correct |
15 ms |
328 KB |
Output is correct |
4 |
Correct |
15 ms |
360 KB |
Output is correct |
5 |
Correct |
15 ms |
448 KB |
Output is correct |
6 |
Correct |
15 ms |
392 KB |
Output is correct |
7 |
Correct |
18 ms |
432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
396 KB |
Output is correct |
2 |
Correct |
16 ms |
380 KB |
Output is correct |
3 |
Correct |
20 ms |
356 KB |
Output is correct |
4 |
Correct |
18 ms |
360 KB |
Output is correct |
5 |
Correct |
20 ms |
420 KB |
Output is correct |
6 |
Correct |
19 ms |
316 KB |
Output is correct |
7 |
Correct |
13 ms |
348 KB |
Output is correct |