이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAX = 150;
int costumes[MAX];
int nat = 1;
int n;
bool hasRepeated(int s,int e, int ref){
int res;
if(s==e){
cout << 2 << " " << ref << " " << s << endl;
cin >> res;
if(res==1){
costumes[s] = costumes[ref];
return true;
}else return false;
}else{
int parts = e-s +1;
cout << parts << " ";
for(int i=s;i<=e;i++){
cout << i;
if(i!=e)
cout<<" ";
else
cout << endl;
}
cin >> res;
int mem = res;
parts++;
cout << parts << " " << ref << " ";
for(int i=s;i<=e;i++){
cout << i;
if(i!=e)
cout<<" ";
else
cout << endl;
}
cin >> res;
return res==mem;
}
}
void check(int s,int e,int ref){
int fHalf;
int sHalf;
int c = e-s+1;
if(c!=1){
fHalf = e-(c/2);
sHalf = fHalf+1;
}else{
fHalf = e;
sHalf= e;
}
if(hasRepeated(s,fHalf,ref) && s!=fHalf){
check(s,fHalf,ref);
}
if(hasRepeated(sHalf,e,ref) && sHalf!=e){
check(sHalf,e,ref);
}
}
int main() {
ios::sync_with_stdio(false);cin.tie(nullptr),cout.tie(nullptr);
cin >> n;
for(int i=1;i<=n;i++){
if(costumes[i]==0){
costumes[i] = nat++;
if(i!=n)
check(i+1,n,i);
}
}
cout << 0 << " ";
for(int i=1;i<=n;i++){
cout << costumes[i];
if(i!=n){
cout<<" ";
}else{
cout<<endl;
}
}
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... |