#include <bits/stdc++.h>
#define int long long
#define pb push_back
using namespace std;
int ask(vector<int>st) {
cout << (int)st.size() << " ";
for(auto X : st) cout << X << " ";
cout << endl;
int x;
cin >> x;
return x;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,cnt = 0;
cin >> n;
vector<int>vec;
int res[n + 1];
vec.pb(1);
res[1] = ++cnt;
for(int i = 2; i <= n; i++) {
vec.pb(i);
if(ask(vec) == (int)vec.size()) {
res[i] = ++cnt;
continue;
}else {
vec.pop_back();
int l = 0,r = (int)vec.size() - 1,ans = -1;
while(l <= r) {
int mid = (l + r) / 2;
vector<int>v;
v.pb(i);
for(int j = mid; j < (int)vec.size(); j++) v.pb(vec[j]);
if(ask(v) != (int)v.size()) {
ans = mid;
l = mid + 1;
}else {
r = mid - 1;
}
}
cout << i << " " << ans << " dbg" << endl;
res[i] = res[vec[ans]];
}
}
cout << 0 << " ";
for(int i = 1; i <= n; i++) cout << res[i] << " ";
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
452 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
448 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
452 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |