답안 #387853

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
387853 2021-04-09T09:40:37 Z Nima_Naderi 사육제 (CEOI14_carnival) C++14
100 / 100
17 ms 408 KB
//In the name of GOD
//#pragma GCC optimize("O2")
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const ll MXN = 150 + 10;
ll n, c;
ll ANS[MXN], Col[MXN];
ll Ask(ll l, ll r, ll x){
	cout << r - l + 2 << ' ' << x << ' ';
	for(int i = l; i <= r; i ++) cout << Col[i] << ' ';
	cout << '\n';
	fflush(stdout);
	cin >> x;
	fflush(stdout);
	return x;
}
int main(){
	//ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
	cin >> n; fflush(stdout);
	ANS[1] = ++ c, Col[1] = 1;
	for(int i = 2; i <= n; i ++){
		ll nw = Ask(1, c, i);
		if(nw > c){
			ANS[i] = ++ c, Col[c] = i;
		}
		else{
			ll l = 1, r = c;
			while(l != r){
				ll mid = (l + r) / 2;
				if(Ask(l, mid, i) == mid - l + 1){
					r = mid;
				}
				else{
					l = mid + 1;
				}
			}
			ANS[i] = ANS[Col[l]];
		}
	}
	fflush(stdout);
	cout << 0 << ' ';
	for(int i = 1; i <= n; i ++) cout << ANS[i] << ' ';
	cout << '\n';
	fflush(stdout);
	return 0;
}
//! N.N
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 408 KB Output is correct
2 Correct 9 ms 200 KB Output is correct
3 Correct 5 ms 292 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 4 ms 200 KB Output is correct
6 Correct 3 ms 200 KB Output is correct
7 Correct 7 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 8 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 6 ms 200 KB Output is correct
7 Correct 5 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 200 KB Output is correct
2 Correct 5 ms 200 KB Output is correct
3 Correct 8 ms 204 KB Output is correct
4 Correct 11 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 7 ms 200 KB Output is correct
7 Correct 6 ms 220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 200 KB Output is correct
2 Correct 5 ms 200 KB Output is correct
3 Correct 5 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 7 ms 200 KB Output is correct
6 Correct 6 ms 200 KB Output is correct
7 Correct 17 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 200 KB Output is correct
2 Correct 5 ms 200 KB Output is correct
3 Correct 6 ms 200 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 6 ms 200 KB Output is correct
6 Correct 5 ms 200 KB Output is correct
7 Correct 4 ms 200 KB Output is correct