//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)==ask(l, l+1, mid))
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);
~~~~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
248 KB |
Output is correct |
2 |
Correct |
59 ms |
308 KB |
Output is correct |
3 |
Correct |
55 ms |
308 KB |
Output is correct |
4 |
Correct |
38 ms |
352 KB |
Output is correct |
5 |
Correct |
40 ms |
352 KB |
Output is correct |
6 |
Correct |
62 ms |
500 KB |
Output is correct |
7 |
Correct |
68 ms |
500 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
500 KB |
Output is correct |
2 |
Correct |
71 ms |
544 KB |
Output is correct |
3 |
Correct |
39 ms |
544 KB |
Output is correct |
4 |
Correct |
42 ms |
544 KB |
Output is correct |
5 |
Correct |
39 ms |
544 KB |
Output is correct |
6 |
Correct |
64 ms |
544 KB |
Output is correct |
7 |
Correct |
51 ms |
544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
544 KB |
Output is correct |
2 |
Correct |
58 ms |
544 KB |
Output is correct |
3 |
Correct |
52 ms |
544 KB |
Output is correct |
4 |
Correct |
47 ms |
544 KB |
Output is correct |
5 |
Correct |
47 ms |
544 KB |
Output is correct |
6 |
Correct |
40 ms |
544 KB |
Output is correct |
7 |
Correct |
66 ms |
544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
544 KB |
Output is correct |
2 |
Correct |
57 ms |
544 KB |
Output is correct |
3 |
Correct |
52 ms |
544 KB |
Output is correct |
4 |
Correct |
61 ms |
544 KB |
Output is correct |
5 |
Correct |
61 ms |
544 KB |
Output is correct |
6 |
Correct |
65 ms |
544 KB |
Output is correct |
7 |
Correct |
63 ms |
544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
544 KB |
Output is correct |
2 |
Correct |
61 ms |
544 KB |
Output is correct |
3 |
Correct |
66 ms |
544 KB |
Output is correct |
4 |
Correct |
55 ms |
544 KB |
Output is correct |
5 |
Correct |
58 ms |
544 KB |
Output is correct |
6 |
Correct |
49 ms |
544 KB |
Output is correct |
7 |
Correct |
63 ms |
544 KB |
Output is correct |