/**
____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|
**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N_MAX = 150;
int ask (vector <int> v) {
if ((int) v.size() <= 1) {
return (int) v.size();
}
cout << (int) v.size() << " ";
for (int i : v) {
cout << i << " ";
}
cout << endl;
int resp;
cin >> resp;
return resp;
}
int N;
int C[N_MAX + 2];
bool isNew (int l, int r) {
vector <int> v;
for (int i = l; i < r; i++) {
v.push_back(i);
}
int without = ask(v);
v.push_back(r);
int with = ask(v);
return (without < with);
}
int main () {
cin >> N;
int k = 0;
for (int i = 1; i <= N; i++) {
// find the first equal to the left
int l = 0, r = i - 1;
while (l < r) {
int mid = (l + r + 1) / 2;
if (isNew(mid, i) == true) {
r = mid - 1;
} else {
l = mid;
}
}
C[i] = (l > 0 ? C[l] : ++k);
}
cout << 0 << " ";
for (int i = 1; i <= N; i++) {
cout << C[i] << " ";
}
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
208 KB |
Output is correct |
2 |
Correct |
18 ms |
208 KB |
Output is correct |
3 |
Correct |
23 ms |
208 KB |
Output is correct |
4 |
Correct |
14 ms |
296 KB |
Output is correct |
5 |
Correct |
16 ms |
296 KB |
Output is correct |
6 |
Correct |
21 ms |
208 KB |
Output is correct |
7 |
Correct |
17 ms |
268 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
208 KB |
Output is correct |
2 |
Correct |
17 ms |
296 KB |
Output is correct |
3 |
Correct |
10 ms |
336 KB |
Output is correct |
4 |
Correct |
23 ms |
300 KB |
Output is correct |
5 |
Correct |
17 ms |
300 KB |
Output is correct |
6 |
Correct |
17 ms |
304 KB |
Output is correct |
7 |
Correct |
19 ms |
284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
300 KB |
Output is correct |
2 |
Correct |
17 ms |
296 KB |
Output is correct |
3 |
Correct |
13 ms |
296 KB |
Output is correct |
4 |
Correct |
24 ms |
304 KB |
Output is correct |
5 |
Correct |
17 ms |
296 KB |
Output is correct |
6 |
Correct |
20 ms |
208 KB |
Output is correct |
7 |
Correct |
17 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
208 KB |
Output is correct |
2 |
Correct |
19 ms |
280 KB |
Output is correct |
3 |
Correct |
28 ms |
284 KB |
Output is correct |
4 |
Correct |
29 ms |
304 KB |
Output is correct |
5 |
Correct |
16 ms |
288 KB |
Output is correct |
6 |
Correct |
22 ms |
208 KB |
Output is correct |
7 |
Correct |
18 ms |
288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
208 KB |
Output is correct |
2 |
Correct |
19 ms |
292 KB |
Output is correct |
3 |
Correct |
22 ms |
284 KB |
Output is correct |
4 |
Correct |
23 ms |
208 KB |
Output is correct |
5 |
Correct |
21 ms |
292 KB |
Output is correct |
6 |
Correct |
24 ms |
304 KB |
Output is correct |
7 |
Correct |
29 ms |
208 KB |
Output is correct |