#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// #include <ext/rope>
using namespace std;
// using namespace __gnu_cxx;
// using namespace __gnu_pbds;
void Hollwo_Pelw();
signed main(){
#ifndef hollwo_pelw_local
if (fopen(".inp", "r"))
assert(freopen(".inp", "r", stdin)), assert(freopen(".out", "w", stdout));
#else
using namespace chrono;
auto start = steady_clock::now();
#endif
cin.tie(0), cout.tie(0) -> sync_with_stdio(0);
int testcases = 1;
// cin >> testcases;
for (int test = 1; test <= testcases; test++){
// cout << "Case #" << test << ": ";
Hollwo_Pelw();
}
#ifdef hollwo_pelw_local
auto end = steady_clock::now();
cout << "\nExecution time : " << duration_cast<milliseconds> (end - start).count() << "[ms]" << endl;
#endif
}
int n, ans[200], col[200];
int query(int i, int t = -1){
cout << i + (t > 0) << ' ';
for (int j = 1; j <= i; j++)
cout << j << ' ';
if (t > 0) cout << t << ' ';
cout << endl;
int x; cin >> x;
return x;
}
void Hollwo_Pelw(){
cin >> n;
ans[1] = col[1] = 1;
int cnt = 1;
for (int i = 2; i <= n; i++){
int x = query(i);
if (x > cnt){
col[i] = col[i-1] + 1;
ans[i] = ++cnt;
}else{
col[i] = col[i-1];
int l = 1, r = i-1;
while (l < r){
int mid = (l+r)/2;
int g = query(mid, i);
if (g == col[mid])
r = mid;
else
l = mid + 1;
}
ans[i] = ans[l];
}
}
cout << "0 ";
for (int i = 1; i <= n; i++)
cout << ans[i] << ' ';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
312 KB |
Output is correct |
2 |
Correct |
6 ms |
208 KB |
Output is correct |
3 |
Correct |
5 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
208 KB |
Output is correct |
5 |
Correct |
9 ms |
208 KB |
Output is correct |
6 |
Correct |
8 ms |
208 KB |
Output is correct |
7 |
Correct |
8 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
208 KB |
Output is correct |
2 |
Correct |
8 ms |
208 KB |
Output is correct |
3 |
Correct |
3 ms |
208 KB |
Output is correct |
4 |
Correct |
4 ms |
316 KB |
Output is correct |
5 |
Correct |
11 ms |
208 KB |
Output is correct |
6 |
Correct |
6 ms |
256 KB |
Output is correct |
7 |
Correct |
10 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
208 KB |
Output is correct |
2 |
Correct |
8 ms |
208 KB |
Output is correct |
3 |
Correct |
8 ms |
208 KB |
Output is correct |
4 |
Correct |
3 ms |
208 KB |
Output is correct |
5 |
Correct |
8 ms |
208 KB |
Output is correct |
6 |
Correct |
11 ms |
208 KB |
Output is correct |
7 |
Correct |
5 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
208 KB |
Output is correct |
2 |
Correct |
11 ms |
208 KB |
Output is correct |
3 |
Correct |
6 ms |
208 KB |
Output is correct |
4 |
Correct |
2 ms |
208 KB |
Output is correct |
5 |
Correct |
7 ms |
208 KB |
Output is correct |
6 |
Correct |
8 ms |
208 KB |
Output is correct |
7 |
Correct |
9 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
208 KB |
Output is correct |
2 |
Correct |
12 ms |
208 KB |
Output is correct |
3 |
Correct |
7 ms |
220 KB |
Output is correct |
4 |
Correct |
7 ms |
208 KB |
Output is correct |
5 |
Correct |
9 ms |
208 KB |
Output is correct |
6 |
Correct |
5 ms |
208 KB |
Output is correct |
7 |
Correct |
4 ms |
208 KB |
Output is correct |