답안 #752695

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
752695 2023-06-03T12:34:28 Z MSK17 사육제 (CEOI14_carnival) C++14
100 / 100
12 ms 304 KB
#include <bits/stdc++.h>

int main(){
	int n,ind{1},last{1};
	std::cin>>n;
	std::vector<int> col(n+1);
	std::vector<int> dist;
	col[1]=ind++;
	dist.push_back(1);
	for(int i{2}; i <= n; ++i){
		std::cout << i << std::endl;
		for(int j{1}; j <= i; ++j){
			std::cout << j << (j==i?"":" ");
		}
		std::cout << std::endl;
		int input;
		std::cin>>input;
		if(input>last){
			dist.push_back(i);
			col[i]=ind++;
		}
		last=input;
	}
	for(int i{1}; i<=n; ++i){
		if(col[i])
			continue;
		int l=0, r=dist.size()-1;
		while(l<r){
			int m=(l+r)/2;
			std::cout << m-l+2 << std::endl;
			for(int j{l}; j <= m; ++j)
				std::cout << dist[j] << " ";
			std::cout << i << std::endl;
			int input;
			std::cin>>input;
			if(input==m-l+1)
				r=m;
			else
				l=m+1;
		}
		col[i]=col[dist[l]];
	}
	std::cout << 0 << " ";
	for(int i{1}; i <= n; ++i)
		std::cout << col[i] << (i==n?"":" ");
	std::cout << std::endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 208 KB Output is correct
2 Correct 8 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 208 KB Output is correct
2 Correct 10 ms 208 KB Output is correct
3 Correct 5 ms 208 KB Output is correct
4 Correct 4 ms 208 KB Output is correct
5 Correct 7 ms 208 KB Output is correct
6 Correct 7 ms 208 KB Output is correct
7 Correct 9 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 208 KB Output is correct
2 Correct 6 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 4 ms 304 KB Output is correct
5 Correct 9 ms 208 KB Output is correct
6 Correct 9 ms 208 KB Output is correct
7 Correct 7 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 208 KB Output is correct
2 Correct 7 ms 208 KB Output is correct
3 Correct 6 ms 208 KB Output is correct
4 Correct 3 ms 208 KB Output is correct
5 Correct 5 ms 208 KB Output is correct
6 Correct 9 ms 208 KB Output is correct
7 Correct 12 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 208 KB Output is correct
2 Correct 9 ms 208 KB Output is correct
3 Correct 7 ms 208 KB Output is correct
4 Correct 6 ms 208 KB Output is correct
5 Correct 7 ms 208 KB Output is correct
6 Correct 3 ms 208 KB Output is correct
7 Correct 4 ms 208 KB Output is correct