이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 155;
int pai[maxn], peso[maxn], colors[maxn];
vector<int> heads;
int query(int tl, int tr, int i){
if(tl == tr) return heads[tl];
int mid = (tl+tr)>>1;
cout << mid - tl + 2 << ' ';
cout << i << ' ';
for(int j = tl; j <= mid; j++) cout << heads[j] << ' ';
cout << endl;
int ans; cin >> ans;
if(ans == mid-tl+1) return query(tl, mid, i);
return query(mid+1, tr, i);
}
int main(){
int n; cin >> n;
int color = 1;
for(int i = 1; i <= n; i++) pai[i] = i;
for(int i = 1; i <= n; i++){
cout << heads.size()+1 << ' ';
cout << i << ' ';
for(int k : heads) cout << k << ' ';
cout << endl;
int ans; cin >> ans;
if(ans == heads.size()+1){
colors[i] = color;
color++;
heads.push_back(i);
continue;
}
pai[i] = query(0, heads.size(), i);
}
for(int i = 0; i <= n; i++) cout << colors[pai[i]] << ' ';
cout << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
carnival.cpp: In function 'int main()':
carnival.cpp:31:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | if(ans == heads.size()+1){
| ~~~~^~~~~~~~~~~~~~~~~
# | 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... |