#include<bits/stdc++.h>
#define pll pair<ll, ll>
#define fi first
#define se second
#define ll long long
#define pb push_back
#define ar array
#define vi vector
#define bit(i,x) ((x >> i) & 1ll)
#define all(x) x.begin(),x.end()
#define low(l,r,x) x.begin()+l,x.begin()+r
#define len(l,r) (r-l+1)
#define PI acos(-1.0)
template <class T> void setmin(T &a, T b) { if(b < a) a = b; }
template <class T> void setmax(T &a, T b) { if(b > a) a = b; }
const long long mod = 998244353, N = 1000, INF = 1e18, Log = 19, MASK = 1 << 19;
using namespace std;
#define int long long
void kazuha() {
ll n ;
cin >> n;
vi<ll> v;
v.push_back(0);
ll cnt = 0;
ll c[n+5];
for(int i = 1; i <= n;i++) {
ll l = 1, r = v.size()-1;
while(l <= r) {
ll mid = (l+r)/2;
cout << v.size() - mid + 1 << " ";
for(int j = mid; j < v.size();j++) {
cout << v[j] << " ";
}
cout << i << endl;
ll x; cin >> x;
if(x == v.size() - mid + 1) {
r = mid - 1;
}
else {
l = mid + 1;
}
}
if(r == 0) {
v.push_back(i);
c[i] = ++cnt;
}
else c[i] = c[v[r]];
}
cout << 0;
for(int i = 1; i <= n;i++) {
cout << " " << c[i];
}
cout << endl;
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
// freopen("permutation.cpp", "r", stdin);
// freopen("permutation.cpp", "w", stdout);
long long mitsu = 1;
// cin >> mitsu;
for(long long seele = 0; seele < mitsu;seele++) {
// cout << "Case " << seele << " :";
kazuha();
}
}
Compilation message
carnival.cpp: In function 'void kazuha()':
carnival.cpp:35:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
35 | for(int j = mid; j < v.size();j++) {
| ~~^~~~~~~~~~
carnival.cpp:40:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
40 | if(x == v.size() - mid + 1) {
| ~~^~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
5 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
6 ms |
600 KB |
Output is correct |
5 |
Correct |
2 ms |
344 KB |
Output is correct |
6 |
Correct |
2 ms |
344 KB |
Output is correct |
7 |
Correct |
3 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
4 ms |
344 KB |
Output is correct |
4 |
Correct |
8 ms |
344 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
4 ms |
344 KB |
Output is correct |
7 |
Correct |
6 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
8 ms |
344 KB |
Output is correct |
4 |
Correct |
8 ms |
704 KB |
Output is correct |
5 |
Correct |
3 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
452 KB |
Output is correct |
7 |
Correct |
4 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
3 ms |
344 KB |
Output is correct |
3 |
Correct |
5 ms |
344 KB |
Output is correct |
4 |
Correct |
6 ms |
456 KB |
Output is correct |
5 |
Correct |
5 ms |
344 KB |
Output is correct |
6 |
Correct |
5 ms |
344 KB |
Output is correct |
7 |
Correct |
6 ms |
344 KB |
Output is correct |