#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define ld long double
// 217
// 44
using namespace std;
const int MAXN = 150;
int arr[MAXN + 1];
inline int ask(int l, int r) {
cout << r - l + 1 << " ";
for(int i = l; i <= r; i++) {
cout << i << " ";
}
cout << "\n";
int ans;
cin >> ans;
return ans;
}
bool vis[MAXN + 1];
inline int get(int l, int r) {
for(int i = l; i <= r; i++) {
vis[arr[i]] = 0;
}
int ans = 0;
for(int i = l; i <= r; i++) {
ans += 1 - vis[arr[i]];
vis[arr[i]] = 1;
}
return ans;
}
int main() {
//ifstream cin("A.in");
//ofstream cout("A.out");
int i, n;
ios::sync_with_stdio(false);
//cin.tie(0), cout.tie(0);
cin >> n;
int cnt = 0;
int id = 0;
for(i = 1; i <= n; i++) {
int cur = ask(1, i);
if(cur > cnt) {
arr[i] = ++id;
}
else {
int res = 0;
for(int step = 1 << 8; step; step >>= 1) {
if(res + step < i && ask(res + step, i) == get(res + step, i - 1)) {
res += step;
}
}
arr[i] = arr[res];
}
cnt = cur;
}
cout << 0 << " ";
for(i = 1; i <= n; i++) {
cout << arr[i] << " ";
}
cout << "\n";
//cin.close();
//cout.close();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
292 KB |
Output is correct |
2 |
Correct |
9 ms |
248 KB |
Output is correct |
3 |
Correct |
7 ms |
248 KB |
Output is correct |
4 |
Correct |
4 ms |
380 KB |
Output is correct |
5 |
Correct |
9 ms |
248 KB |
Output is correct |
6 |
Correct |
4 ms |
248 KB |
Output is correct |
7 |
Correct |
11 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
248 KB |
Output is correct |
2 |
Correct |
11 ms |
376 KB |
Output is correct |
3 |
Correct |
5 ms |
248 KB |
Output is correct |
4 |
Correct |
4 ms |
376 KB |
Output is correct |
5 |
Correct |
9 ms |
376 KB |
Output is correct |
6 |
Correct |
8 ms |
248 KB |
Output is correct |
7 |
Correct |
11 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
376 KB |
Output is correct |
2 |
Correct |
11 ms |
248 KB |
Output is correct |
3 |
Correct |
7 ms |
248 KB |
Output is correct |
4 |
Correct |
3 ms |
380 KB |
Output is correct |
5 |
Correct |
8 ms |
376 KB |
Output is correct |
6 |
Correct |
7 ms |
380 KB |
Output is correct |
7 |
Correct |
12 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
248 KB |
Output is correct |
2 |
Correct |
11 ms |
248 KB |
Output is correct |
3 |
Correct |
6 ms |
248 KB |
Output is correct |
4 |
Correct |
4 ms |
248 KB |
Output is correct |
5 |
Correct |
9 ms |
376 KB |
Output is correct |
6 |
Correct |
7 ms |
248 KB |
Output is correct |
7 |
Correct |
6 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
376 KB |
Output is correct |
2 |
Correct |
11 ms |
248 KB |
Output is correct |
3 |
Correct |
5 ms |
396 KB |
Output is correct |
4 |
Correct |
8 ms |
376 KB |
Output is correct |
5 |
Correct |
4 ms |
248 KB |
Output is correct |
6 |
Correct |
4 ms |
248 KB |
Output is correct |
7 |
Correct |
5 ms |
248 KB |
Output is correct |