답안 #1113935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113935 2024-11-17T21:08:37 Z Dan4Life 사육제 (CEOI14_carnival) C++17
100 / 100
16 ms 616 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
using vi = vector<int>;
int n, col[300];

int query(vi v){
	cout << sz(v) << " ";
	for(auto u : v) cout << u << " ";
	cout << endl;
	int x; cin >> x; return x;
}

int main(){
	cin >> n; vi v, w; v.pb(1);
	for(int i = 2; i <= n; i++){
		v.pb(i);
		if(query(v)!=sz(v)) v.pop_back(),w.pb(i);
	} 
	for(int i = 0; i < sz(v); i++) col[v[i]]=i+1;
	for(auto u : w){
		int l = 0, r = sz(v)-1;
		while(l<r){
			int mid = (l+r)/2;
			vi x; x.clear();
			for(int i = 0; i <= mid; i++) x.pb(v[i]);
			x.pb(u);
			if(query(x) == sz(x)) l=mid+1;
			else r=mid;
		}
		col[u] = col[v[l]];
	}
	cout << 0 << " ";
	for(int i = 1; i <= n; i++) cout << col[i] << " ";
	cout << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 336 KB Output is correct
2 Correct 13 ms 336 KB Output is correct
3 Correct 8 ms 336 KB Output is correct
4 Correct 4 ms 336 KB Output is correct
5 Correct 6 ms 508 KB Output is correct
6 Correct 5 ms 336 KB Output is correct
7 Correct 11 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 336 KB Output is correct
2 Correct 10 ms 336 KB Output is correct
3 Correct 7 ms 512 KB Output is correct
4 Correct 6 ms 336 KB Output is correct
5 Correct 13 ms 336 KB Output is correct
6 Correct 12 ms 336 KB Output is correct
7 Correct 12 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 508 KB Output is correct
2 Correct 9 ms 336 KB Output is correct
3 Correct 16 ms 592 KB Output is correct
4 Correct 5 ms 616 KB Output is correct
5 Correct 12 ms 336 KB Output is correct
6 Correct 13 ms 440 KB Output is correct
7 Correct 11 ms 592 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 336 KB Output is correct
2 Correct 9 ms 336 KB Output is correct
3 Correct 6 ms 336 KB Output is correct
4 Correct 4 ms 508 KB Output is correct
5 Correct 11 ms 336 KB Output is correct
6 Correct 13 ms 336 KB Output is correct
7 Correct 10 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 336 KB Output is correct
2 Correct 9 ms 336 KB Output is correct
3 Correct 11 ms 592 KB Output is correct
4 Correct 9 ms 336 KB Output is correct
5 Correct 10 ms 336 KB Output is correct
6 Correct 9 ms 444 KB Output is correct
7 Correct 5 ms 336 KB Output is correct