#include <bits/stdc++.h>
using namespace std;
int N, memo[200][200], c[200], ind;
int tanya(int l, int r) {
if (r-l+1 < 2) return r-l+1;
int &ret = memo[l][r];
if (ret != -1) return ret;
cout << r-l+1;
for (;l<=r;l++) cout << " " << l;
cout << endl;
fflush(stdout);
cin >> ret;
return ret;
}
int main() {
cin >> N;
memset(memo, -1, sizeof(memo));
memset(c, -1, sizeof(c));
for (int i = 1; i <= N; i++) {
if (c[i] == -1) {
ind++;
c[i] = ind;
}
if (tanya(i, N)>tanya(i+1, N)) continue;
int L = i+1;
int R = N;
while (L<R) {
int md = (L+R)/2;
int t1 = tanya(i, md);
int t2 = tanya(i+1, md);
if (t2<t1){
L = md+1;
} else {
R = md;
}
}
c[L] = c[i];
}
cout << "0";
for (int i = 1; i <= N; i++) cout << " " << c[i];
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
384 KB |
Output is correct |
2 |
Correct |
14 ms |
512 KB |
Output is correct |
3 |
Correct |
10 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
14 ms |
512 KB |
Output is correct |
6 |
Correct |
15 ms |
384 KB |
Output is correct |
7 |
Correct |
18 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
512 KB |
Output is correct |
2 |
Correct |
17 ms |
384 KB |
Output is correct |
3 |
Correct |
8 ms |
384 KB |
Output is correct |
4 |
Correct |
6 ms |
384 KB |
Output is correct |
5 |
Correct |
17 ms |
512 KB |
Output is correct |
6 |
Correct |
15 ms |
384 KB |
Output is correct |
7 |
Correct |
22 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
384 KB |
Output is correct |
2 |
Correct |
18 ms |
512 KB |
Output is correct |
3 |
Correct |
14 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
13 ms |
640 KB |
Output is correct |
6 |
Correct |
8 ms |
384 KB |
Output is correct |
7 |
Correct |
13 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
18 ms |
512 KB |
Output is correct |
2 |
Correct |
14 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
512 KB |
Output is correct |
5 |
Correct |
8 ms |
384 KB |
Output is correct |
6 |
Correct |
10 ms |
384 KB |
Output is correct |
7 |
Correct |
13 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
512 KB |
Output is correct |
2 |
Correct |
10 ms |
512 KB |
Output is correct |
3 |
Correct |
12 ms |
512 KB |
Output is correct |
4 |
Correct |
9 ms |
512 KB |
Output is correct |
5 |
Correct |
13 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |