# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
46196 | ikura355 | 사육제 (CEOI14_carnival) | C++14 | 15 ms | 576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int maxn = 150 + 5;
int n;
int c, rep[maxn], com[maxn];
vector<int> p, act;
int ask() {
printf("%d",act.size());
for(auto x : act) printf(" %d",x);
printf("\n");
fflush(stdout);
int ret; scanf("%d",&ret);
return ret;
}
int noey(int l, int r, int x) {
act.clear();
for(int i=l;i<=r;i++) act.push_back(p[i]);
int old = ask();
act.push_back(x);
int boy = ask();
return old == boy;
}
void connect(int x) {
p.clear();
for(int i=1;i<=c;i++) p.push_back(rep[i]);
//1. new component
if(c==0 || !noey(0,p.size()-1,x)) {
rep[++c] = x;
com[x] = c;
return ;
}
//2. connecting
int l = 0, r = p.size()-1;
while(l<r) {
int mid = (l+r)/2;
if(noey(l,mid,x)) r = mid;
else l = mid+1;
}
com[x] = com[p[l]];
}
int main() {
scanf("%d",&n);
for(int x=1;x<=n;x++) connect(x);
printf("0");
for(int x=1;x<=n;x++) printf(" %d",com[x]);
fflush(stdout);
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |