답안 #166885

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166885 2019-12-04T13:19:06 Z dyd 사육제 (CEOI14_carnival) C++14
0 / 100
2 ms 376 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200;
int v[MAXN];
int n;
void f(int i,int ini,int fim){
	if(ini==fim){
		int x;
		printf("2 %d %d",i,ini);
		scanf("%d",&x);
		if(x==1) v[ini]=v[i];
		return;
	}
	int ci,si;
	printf("%d %d",fim-ini+2,i);
	for(int j=ini;j<=fim;j++) printf(" %d",j);
	scanf("%d",&ci);
	printf("%d",fim-ini+1);
	for(int j=ini;j<=fim;j++) printf(" %d",j);
	scanf("%d",&si);
	if(ci!=si) return;
	int m=(ini+fim)/2;
	f(i,ini,m);
	f(i,m+1,fim);
}
int main(){
	int t,cont=1;
	scanf("%d",&n);
	printf("%d",n);
	for(int i=1;i<=n;i++) printf(" %d",i);
	scanf("%d",&t);
	for(int i=1;i<n;i++){
		if(v[i]!=0) continue;
		v[i]=cont;
		cont++;
		f(i,i+1,n);
		if(cont>t) break;
	}
	printf("0");
	for(int i=1;i<=n;i++) printf(" %d",v[i]);
}

Compilation message

carnival.cpp: In function 'void f(int, int, int)':
carnival.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
carnival.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&ci);
  ~~~~~^~~~~~~~~~
carnival.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&si);
  ~~~~~^~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
carnival.cpp:31:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&t);
  ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 252 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 248 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 376 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -