답안 #930367

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
930367 2024-02-19T13:02:12 Z ByeWorld 사육제 (CEOI14_carnival) C++14
100 / 100
4 ms 440 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
//#define int long long
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;
const int INF = 1e9+10;
const int MAXN = 1e6+10;

int n;
int a[200], cnt, val;
vector <int> vec;

int bin(int idx){
	int l=1, r=vec.size()-1, mid=-1;
	if(l==r){
		return l;
	}
	while(l<r){
		mid = md;

		cout << mid-l+2 << ' '; // l --> mid
		for(int i=l; i<=mid; i++) cout << vec[i] << ' ';
		cout << idx << endl;
		int te; cin >> te;

		if(te == mid-l+1){ // ada di segment l --> mid
			r = mid;
		} else l = mid+1;

		if(l==r){
			return l;
		}
	}
	return -1;
}
signed main() {
	cin >> n;
	a[1] = ++cnt;
	vec.pb(-1);
	vec.pb(1);

	for(int i=2; i<=n; i++){
		cout << i << ' ';
		for(int j=1; j<=i; j++) cout << j << ' ';
		cout << endl;

		int num; cin >> num;
		if(num == cnt+1){
			a[i] = ++cnt; vec.pb(i); 
		} else {
			int idx = bin(i);
			//cout << i << ' ' << idx << " pp\n";
			assert(idx != -1);
			a[i] = idx;
		}
		//for(auto in : vec) cout << in << ' ';
			//cout << " done\n";
	}
	cout << "0 ";
	for(int i=1; i<=n; i++) cout << a[i] << ' ';
	cout << endl; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 432 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
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 436 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 1 ms 440 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 436 KB Output is correct