제출 #1209568

#제출 시각아이디문제언어결과실행 시간메모리
1209568crazy0215Carnival (CEOI14_carnival)C++20
0 / 100
2 ms432 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second
#define pb push_back
#define show(x) cout << #x << " " << x << "\n";
#define showds(x) cout << #x << " "; for(auto y : x) cout << y << " "; cout << "\n";
typedef pair<int, int> ii;

bool cmp(ii a, ii b) {
	return a.fi<b.fi;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    cout << n << " ";
    for (int i=1; i<=n; i++) cout << i << ' ';
    cout << endl;
    int x; cin >> x;
    int a[n+1]={0}, b[x+1]={0};
    a[1]=1, b[1]=1;
    int ptr=1;
    for (int i=2; i<=n; i++) {
		cout << ptr+1 << ' ';
		for (int j=1; j<=ptr; j++) cout << b[j] << ' ';
		cout << i << endl;
		int y; cin >> y;
		if (y!=ptr) {
			ptr++, b[ptr]=i, a[i]=ptr;
			continue;
		}
		int l=1, u=ptr;
		while (l+1<u) {
			int mid=(l+u)/2;
			cout << mid-l+2 << ' ';
			for (int j=l; j<=mid; j++) cout << b[j] << ' ';
			cout << i << endl;
			int z; cin >> z;
			if (z!=mid) l=mid+1;
			else u=mid;
		}
		cout << "2 ";
		cout << a[l] << ' ' << i << endl;
		int z; cin >> z;
		if (z==1) a[i]=l;
		else a[i]=u;
	}
	cout << "0 ";
	for (int i=1; i<=n; i++) cout << a[i] << ' ';
	cout << endl;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...