답안 #25915

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25915 2017-06-25T06:11:18 Z imsifile 사육제 (CEOI14_carnival) C++
100 / 100
13 ms 1116 KB
#include<stdio.h>

int N, ba[222], numix[222];

int getrange(int s, int e){
	printf("%d ", e-s+1);
	for(int i=s; i<=e; i++) printf("%d ", i);
	fflush(stdout);

	int res; scanf("%d", &res);
	return res;
}

int getin(int ix, int s, int e){
	printf("%d %d ", e-s+2, ix);
	for(int i=s; i<=e; i++) printf("%d ", numix[i]);
	fflush(stdout);

	int res; scanf("%d", &res);
	return res;
}

int main(){
	scanf("%d", &N);
	int pv=0;
	for(int i=1; i<=N; i++){
		int cn = getrange(1,i);
		if(pv<cn) ba[i]=cn, numix[cn]=i;
		pv=cn;
	}
	for(int i=1; i<=N; i++){
		if(ba[i])continue;
		int mi=1, mx=pv, md;
		while(1){
			md=(mi+mx)/2;
			if(mi>=mx) break;
			int cn = getin(i, mi, md);
			if(cn == md-mi+1) mx=md;
			else mi=md+1;
		}
		ba[i]=md;
	}
	printf("0 ");
	for(int i=1; i<=N; i++) printf("%d ", ba[i]);
	fflush(stdout);
	return 0;
}

Compilation message

carnival.cpp: In function 'int getrange(int, int)':
carnival.cpp:10:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int res; scanf("%d", &res);
                            ^
carnival.cpp: In function 'int getin(int, int, int)':
carnival.cpp:19:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int res; scanf("%d", &res);
                            ^
carnival.cpp: In function 'int main()':
carnival.cpp:24:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
3 Correct 9 ms 1116 KB Output is correct
4 Correct 3 ms 1116 KB Output is correct
5 Correct 0 ms 1116 KB Output is correct
6 Correct 0 ms 1116 KB Output is correct
7 Correct 0 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1116 KB Output is correct
2 Correct 6 ms 1116 KB Output is correct
3 Correct 6 ms 1116 KB Output is correct
4 Correct 6 ms 1116 KB Output is correct
5 Correct 0 ms 1116 KB Output is correct
6 Correct 0 ms 1116 KB Output is correct
7 Correct 9 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 0 ms 1116 KB Output is correct
3 Correct 3 ms 1116 KB Output is correct
4 Correct 0 ms 1116 KB Output is correct
5 Correct 6 ms 1116 KB Output is correct
6 Correct 13 ms 1116 KB Output is correct
7 Correct 6 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 3 ms 1116 KB Output is correct
3 Correct 0 ms 1116 KB Output is correct
4 Correct 0 ms 1116 KB Output is correct
5 Correct 3 ms 1116 KB Output is correct
6 Correct 6 ms 1116 KB Output is correct
7 Correct 6 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1116 KB Output is correct
2 Correct 3 ms 1116 KB Output is correct
3 Correct 0 ms 1116 KB Output is correct
4 Correct 6 ms 1116 KB Output is correct
5 Correct 0 ms 1116 KB Output is correct
6 Correct 6 ms 1116 KB Output is correct
7 Correct 3 ms 1116 KB Output is correct