//I love armpit fetish
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"
const int MAX_N = 152;
int n, nColor, c[MAX_N];
int ask(int u, int l, int r) {
printf("%d ", r-l+2);
fflush(stdout);
printf("%d ", u);
fflush(stdout);
fflush(stdout);
for (int i=l; i<=r; ++i) {
printf("%d ", i);
fflush(stdout);
}
printf("\n");
fflush(stdout);
int res;
cin >> res;
return res;
}
void solve(int u) {
int l = u+1, r = n;
while (l<r) {
int mid = (l + r) / 2;
if (ask(u, l, mid)<mid-l+2)
r = mid;
else
l = mid + 1;
}
if (ask(u, r, r)==1)
c[u] = -r;
else
c[u] = ++nColor;
}
void find_result() {
c[n] = ++nColor;
for (int i=n; i>=1; --i)
if (c[i]<0)
c[i] = c[-c[i]];
printf("0 ");
fflush(stdout);
for (int i=1; i<=n; ++i) {
printf("%d ", c[i]);
fflush(stdout);
}
fflush(stdout);
}
int main() {
//#define OFFLINE_JUDGE doraemon
#ifdef OFFLINE_JUDGE
freopen(FILE_NAME".inp", "r", stdin);
freopen(FILE_NAME".out", "w", stdout);
#endif
//ios::sync_with_stdio(0); cin.tie(0);
scanf("%d", &n);
for (int i=1; i<n; ++i)
solve(i);
find_result();
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:69:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
~~~~~^~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
376 KB |
Integer 15 violates the range [1, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
24 ms |
440 KB |
Integer 6 violates the range [1, 5] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
516 KB |
Output is correct |
2 |
Incorrect |
21 ms |
516 KB |
Integer 9 violates the range [1, 8] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
22 ms |
516 KB |
Integer 5 violates the range [1, 4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
28 ms |
516 KB |
Integer 5 violates the range [1, 2] |
2 |
Halted |
0 ms |
0 KB |
- |