답안 #103420

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
103420 2019-03-30T12:15:25 Z Diuven 사육제 (CEOI14_carnival) C++14
100 / 100
29 ms 384 KB
#include <iostream>
using namespace std;

int ask(int s, int e){
	cout<<e-s+1<<' ';
	for(int i=s; i<=e; i++) cout<<i<<' ';
	cout<<endl;
	int ans; cin>>ans;
	return ans;
}

int main(){
	int n, m=0; cin>>n;
	int C[151]={};
	C[1]=++m;

	for(int i=2; i<=n; i++){
		if(ask(1,i)==ask(1,i-1)+1){
			C[i] = ++m;
		} else {
			int s=1, e=i-1;
			while(s<e){
				int mid = (s+e+1)/2;
				if(ask(mid, i)==ask(mid, i-1)+1) e=mid-1;
				else s=mid;
			}
			C[i] = C[s];
		}
	}

	cout<<0<<' ';
	for(int i=1; i<=n; i++) cout<<C[i]<<' ';
	cout<<endl;

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 256 KB Output is correct
2 Correct 23 ms 256 KB Output is correct
3 Correct 11 ms 256 KB Output is correct
4 Correct 10 ms 384 KB Output is correct
5 Correct 20 ms 384 KB Output is correct
6 Correct 24 ms 384 KB Output is correct
7 Correct 21 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 384 KB Output is correct
2 Correct 24 ms 256 KB Output is correct
3 Correct 8 ms 256 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 24 ms 384 KB Output is correct
6 Correct 24 ms 384 KB Output is correct
7 Correct 11 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 384 KB Output is correct
2 Correct 29 ms 384 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 25 ms 384 KB Output is correct
6 Correct 18 ms 384 KB Output is correct
7 Correct 21 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 256 KB Output is correct
2 Correct 25 ms 384 KB Output is correct
3 Correct 7 ms 256 KB Output is correct
4 Correct 7 ms 256 KB Output is correct
5 Correct 11 ms 384 KB Output is correct
6 Correct 15 ms 384 KB Output is correct
7 Correct 13 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 384 KB Output is correct
2 Correct 14 ms 256 KB Output is correct
3 Correct 11 ms 256 KB Output is correct
4 Correct 10 ms 256 KB Output is correct
5 Correct 17 ms 384 KB Output is correct
6 Correct 7 ms 256 KB Output is correct
7 Correct 8 ms 256 KB Output is correct