이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn=200;
int boja[maxn];
int binary(int x){
int lo=1, hi=x, mid;
int a, b;
while(lo<hi){
mid=(lo+hi)/2;
cout << mid << ' ';
for(int i=x-mid; i<x; i++){
cout << i+1 << ' ';
}
cout << '\n';
cout.flush();
cin >> a;
cout << mid+1 << ' ';
for(int i=x-mid; i<=x; i++){
cout << i+1 << ' ';
}
cout << '\n';
cout.flush();
cin >> b;
if(a==b){
hi=mid;
}
else{
lo=mid+1;
}
}
return boja[x-lo];
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
int prosl=1;
int sad;
boja[0]=1;
int nova=2;
for(int i=1; i<n; i++){
cout << i+1 << ' ';
for(int j=0; j<=i; j++){
cout << j+1 << ' ';
}
cout << '\n';
cout.flush();
cin >> sad;
if(prosl==sad){
boja[i]=binary(i);
}
else{
boja[i]=nova;
nova++;
}
prosl=sad;
}
cout << 0 << ' ';
for(int i=0; i<n; i++){
cout << boja[i] << ' ';
}
cout << '\n';
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... |