#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int col[155];
vector <int> vec;
void trazi(int l, int r, int k){
if(l == r){
col[k] = col[vec[l]];
return;
}
int mid = (l+r)/2;
cout << mid-l+2 << " ";
for(int i=l; i<=mid; i++){
cout << vec[i] << " ";
}
cout << k << endl;
int x;
cin >> x;
if(x != mid-l+2) trazi(l, mid, k);
else trazi(mid+1, r, k);
}
int main(){
ios_base::sync_with_stdio(false);
cout.precision(10);
cout<<fixed;
int n;
cin >> n;
col[1] = 1;
vec.push_back(1);
for(int i=2; i<=n; i++){
cout << vec.size() + 1 << " ";
for(auto c : vec) cout << c << " ";
cout << i << endl;
int x;
cin >> x;
if(x > vec.size()){
col[i] = vec.size() + 1;
vec.push_back(i);
continue;
}
trazi(0, vec.size()-1, i);
}
cout << "0 ";
for(int i=1; i<=n; i++) cout << col[i] << " ";
cout << endl;
return 0;
}
Compilation message
carnival.cpp: In function 'int main()':
carnival.cpp:42:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if(x > vec.size()){
~~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
248 KB |
Output is correct |
2 |
Correct |
9 ms |
248 KB |
Output is correct |
3 |
Correct |
7 ms |
248 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
6 ms |
248 KB |
Output is correct |
6 |
Correct |
5 ms |
248 KB |
Output is correct |
7 |
Correct |
11 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
248 KB |
Output is correct |
2 |
Correct |
8 ms |
244 KB |
Output is correct |
3 |
Correct |
7 ms |
248 KB |
Output is correct |
4 |
Correct |
6 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
8 ms |
248 KB |
Output is correct |
7 |
Correct |
10 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
248 KB |
Output is correct |
2 |
Correct |
5 ms |
248 KB |
Output is correct |
3 |
Correct |
11 ms |
248 KB |
Output is correct |
4 |
Correct |
4 ms |
332 KB |
Output is correct |
5 |
Correct |
8 ms |
380 KB |
Output is correct |
6 |
Correct |
10 ms |
248 KB |
Output is correct |
7 |
Correct |
10 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
248 KB |
Output is correct |
2 |
Correct |
8 ms |
376 KB |
Output is correct |
3 |
Correct |
8 ms |
248 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
5 |
Correct |
10 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
252 KB |
Output is correct |
7 |
Correct |
10 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
252 KB |
Output is correct |
2 |
Correct |
8 ms |
376 KB |
Output is correct |
3 |
Correct |
10 ms |
248 KB |
Output is correct |
4 |
Correct |
9 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
248 KB |
Output is correct |
6 |
Correct |
7 ms |
420 KB |
Output is correct |
7 |
Correct |
6 ms |
376 KB |
Output is correct |