#include <iostream>
#define MAXN 152
using namespace std;
int F[MAXN] = {0};
void busca (int x, int ini, int fim, int n) {
int C1, C2;
F[x] = n;
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];
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) 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;
int n = 0;
for (int i = 1; i <= N; i++) if (F[i] == 0) busca(i, 1, N, ++n);
cout << 0;
for (int i = 1; i <= N; i++) cout << " " << F[i];
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
248 KB |
Output is correct |
2 |
Correct |
15 ms |
248 KB |
Output is correct |
3 |
Correct |
22 ms |
376 KB |
Output is correct |
4 |
Correct |
12 ms |
248 KB |
Output is correct |
5 |
Correct |
9 ms |
380 KB |
Output is correct |
6 |
Correct |
7 ms |
248 KB |
Output is correct |
7 |
Correct |
21 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
376 KB |
Output is correct |
2 |
Correct |
18 ms |
248 KB |
Output is correct |
3 |
Correct |
17 ms |
248 KB |
Output is correct |
4 |
Correct |
12 ms |
248 KB |
Output is correct |
5 |
Correct |
13 ms |
376 KB |
Output is correct |
6 |
Correct |
9 ms |
376 KB |
Output is correct |
7 |
Correct |
15 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
376 KB |
Output is correct |
2 |
Correct |
21 ms |
248 KB |
Output is correct |
3 |
Correct |
31 ms |
248 KB |
Output is correct |
4 |
Correct |
11 ms |
248 KB |
Output is correct |
5 |
Correct |
12 ms |
252 KB |
Output is correct |
6 |
Correct |
8 ms |
380 KB |
Output is correct |
7 |
Correct |
20 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
376 KB |
Output is correct |
2 |
Correct |
18 ms |
376 KB |
Output is correct |
3 |
Correct |
19 ms |
252 KB |
Output is correct |
4 |
Correct |
11 ms |
248 KB |
Output is correct |
5 |
Correct |
13 ms |
376 KB |
Output is correct |
6 |
Correct |
14 ms |
376 KB |
Output is correct |
7 |
Correct |
28 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
248 KB |
Output is correct |
2 |
Correct |
14 ms |
248 KB |
Output is correct |
3 |
Correct |
15 ms |
248 KB |
Output is correct |
4 |
Correct |
22 ms |
376 KB |
Output is correct |
5 |
Correct |
13 ms |
248 KB |
Output is correct |
6 |
Correct |
11 ms |
376 KB |
Output is correct |
7 |
Correct |
12 ms |
376 KB |
Output is correct |