답안 #166899

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
166899 2019-12-04T13:41:42 Z dyd 사육제 (CEOI14_carnival) C++14
0 / 100
2 ms 380 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200;
int v[MAXN];
int p[MAXN][MAXN];
int n;
int fp(int ini,int fim){
	if(p[ini][fim]!=0) return p[ini][fim];
	int resp;
	printf("%d",fim-ini+1);
	for(int j=ini;j<=fim;j++) printf(" %d",j);
	scanf("%d",&resp);
	return p[ini][fim]=resp;
} 
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;
	if(i==ini-1) ci=fp(i,fim);
	else{
		printf("%d %d",fim-ini+2,i);
		for(int j=ini;j<=fim;j++) printf(" %d",j);
		scanf("%d",&ci);
	}
	si=fp(ini,fim);
	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++;
		if(i==n) continue;
		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 'int fp(int, int)':
carnival.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&resp);
  ~~~~~^~~~~~~~~~~~
carnival.cpp: In function 'void f(int, int, int)':
carnival.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&x);
   ~~~~~^~~~~~~~~
carnival.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&ci);
   ~~~~~^~~~~~~~~~
carnival.cpp: In function 'int main()':
carnival.cpp:38:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
carnival.cpp:41: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 380 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 -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2 ms 296 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -