#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 << 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(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
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 << 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;
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:30:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | if(ans == heads.size()+1){
| ~~~~^~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |