#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
//#define int long long
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;
const int INF = 1e9+10;
const int MAXN = 1e6+10;
int n;
int a[200], cnt, val;
vector <int> vec;
int bin(int idx){
int l=1, r=vec.size()-1, mid=-1;
if(l==r){
return l;
}
while(l<r){
mid = md;
cout << mid-l+2 << ' '; // l --> mid
for(int i=l; i<=mid; i++) cout << vec[i] << ' ';
cout << idx << endl;
int te; cin >> te;
if(te == mid-l+1){ // ada di segment l --> mid
r = mid;
} else l = mid;
if(l==r){
return l;
}
}
return -1;
}
signed main() {
cin >> n;
a[1] = ++cnt;
vec.pb(-1);
vec.pb(1);
for(int i=2; i<=n; i++){
cout << i << ' ';
for(int j=1; j<=i; j++) cout << j << ' ';
cout << endl;
int num; cin >> num;
if(num == cnt+1){
a[i] = ++cnt; vec.pb(i);
} else {
int idx = bin(i);
assert(idx != -1);
a[i] = a[idx];
}
}
cout << "0 ";
for(int i=1; i<=n; i++) cout << a[i] << ' ';
cout << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
53 ms |
408 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
50 ms |
412 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Runtime error |
46 ms |
408 KB |
Execution killed with signal 13 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
49 ms |
412 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
45 ms |
408 KB |
Execution killed with signal 13 |
2 |
Halted |
0 ms |
0 KB |
- |