이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define pii pair<ll, ll>
#define oo 1e9
int n;
int main(){
cin >> n;
int ans[n + 1];
vector<int> v;
ans[1] = 1;
cout << n << ' ';
for(int i = 1; i <= n; i++){
cout << i << ' ';
}
cout << endl;
int C; cin >> C;
int c = 1;
for(int i = 2; i <= n; i++){
int l = 1, r = i - 1;
cout << i << ' ';
for(int j = 1; j <= i; j++){
cout << j << ' ';
}
cout << endl;
int tmp; cin >> tmp;
if(tmp != c){
ans[i] = ++c;
continue;
}
while(l < r){
int mid = (l + r) / 2;
cout << mid - l + 1 << ' ';
for(int j = l; j <= mid; j++){
cout << j << ' ';
}
cout << endl;
int a; cin >> a;
cout << mid - l + 2 << ' ';
for(int j = l; j <= mid; j++){
cout << j << ' ';
}
cout << i << ' ';
cout << endl;
int b; cin >> b;
if(a == b){
r = mid;
}
else{
l = mid + 1;
}
}
ans[i] = l;
}
cout << "0 ";
for(int i = 1; i <= n; i++){
cout << ans[i] << ' ';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |