#include <bits/stdc++.h>
#define MAXN 152
using namespace std;
int F[MAXN];
void busca (int x, int ini, int fim, int n) {
int C1, C2;
if (ini > fim) return;
if (ini == fim) {
if (ini == x) return;
cout << 2 << " " << x << " " << ini << endl;
cin >> C1;
if (C1 == 1) F[ini] = F[x] = n;
return;
}
cout << fim-ini+(x < ini || x > fim);
for (int i = ini; i <= fim; i++) {
if (i == x) continue;
cout << " " << i;
}
cout << endl;
cin >> C1;
cout << fim-ini+1+(x < ini || x > fim);
cout << " " << x;
for (int i = ini; i <= fim; i++) {
if (i == x) continue;
cout << " " << i;
}
cout << endl;
cin >> C2;
if (C1 != C2) {
F[x] = n;
return;
}
int meio = (ini+fim)/2;
if (fim == meio) meio = ini;
busca(x, ini, meio, n);
busca(x, meio+1, fim, n);
}
int main () {
int N;
cin >> N;
memset(F, -1, sizeof(F));
int n = 0;
for (int i = 1; i <= N; i++) if (F[i] == -1) busca(i, 1, N, ++n);
cout << 0;
for (int i = 1; i <= N; i++) cout << " " << F[i];
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
376 KB |
Output is correct |
2 |
Correct |
29 ms |
256 KB |
Output is correct |
3 |
Correct |
20 ms |
248 KB |
Output is correct |
4 |
Correct |
8 ms |
376 KB |
Output is correct |
5 |
Correct |
11 ms |
128 KB |
Output is correct |
6 |
Correct |
7 ms |
248 KB |
Output is correct |
7 |
Correct |
19 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
376 KB |
Output is correct |
2 |
Correct |
31 ms |
248 KB |
Output is correct |
3 |
Correct |
16 ms |
248 KB |
Output is correct |
4 |
Correct |
9 ms |
248 KB |
Output is correct |
5 |
Correct |
11 ms |
248 KB |
Output is correct |
6 |
Correct |
9 ms |
248 KB |
Output is correct |
7 |
Correct |
21 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
376 KB |
Output is correct |
2 |
Correct |
22 ms |
376 KB |
Output is correct |
3 |
Correct |
31 ms |
248 KB |
Output is correct |
4 |
Correct |
14 ms |
248 KB |
Output is correct |
5 |
Correct |
7 ms |
248 KB |
Output is correct |
6 |
Correct |
10 ms |
248 KB |
Output is correct |
7 |
Correct |
16 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
248 KB |
Output is correct |
2 |
Correct |
19 ms |
248 KB |
Output is correct |
3 |
Correct |
17 ms |
248 KB |
Output is correct |
4 |
Correct |
10 ms |
248 KB |
Output is correct |
5 |
Correct |
13 ms |
376 KB |
Output is correct |
6 |
Correct |
10 ms |
380 KB |
Output is correct |
7 |
Correct |
25 ms |
252 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
252 KB |
Output is correct |
2 |
Correct |
24 ms |
252 KB |
Output is correct |
3 |
Correct |
25 ms |
376 KB |
Output is correct |
4 |
Correct |
21 ms |
248 KB |
Output is correct |
5 |
Correct |
13 ms |
248 KB |
Output is correct |
6 |
Correct |
11 ms |
248 KB |
Output is correct |
7 |
Correct |
13 ms |
248 KB |
Output is correct |