#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 i = mid; i < v.size();i++) {
cout << v[i] << " ";
}
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[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 i = mid; i < v.size();i++) {
| ~~^~~~~~~~~~
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) {
| ~~^~~~~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
2 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Incorrect |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Incorrect |
3 ms |
344 KB |
Incorrect |
3 |
Halted |
0 ms |
0 KB |
- |