답안 #25913

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25913 2017-06-25T05:54:03 Z 서규호(#1088) 사육제 (CEOI14_carnival) C++14
0 / 100
0 ms 2020 KB
#include <bits/stdc++.h>

#define lld long long
#define pp pair<int,int>
#define pb push_back
#define MOD 1000000007
#define left lleft
#define right rright
#define INF 2000000000
#define Linf 1000000000000000000LL
#define next nnext
#define minus mminus

using namespace std;

int N;
int a[200];
bool check[200];

void query(int s,int e,int x){
	vector<int> tmp;
	for(int i=s; i<=e; i++) tmp.pb(i);
	tmp.pb(x);
	printf("%d ",tmp.size());
	for(auto &i : tmp) printf("%d ",i);
	puts("");
}

int get(int s,int e){
	int cnt = 0;
	for(int i=s; i<=e; i++){
		if(!check[a[i]]) cnt++;
		check[a[i]] = true;
	}
	for(int i=s; i<=e; i++){
		check[a[i]] = false;
	}
	return cnt;
}

int main(){
	scanf("%d",&N);
	int color = 1;
	a[1] = 1;
	for(int i=2; i<=N; i++){
		int tmp;
		query(1,i-1,i);
		scanf("%d",&tmp);
		if(tmp == get(1,i-1)+1){
			a[i] = ++color;
			continue;
		}
		for(int j=1; j<i; j++){
			query(j,j,i);
			scanf("%d",&tmp);
			if(tmp == 1){
				a[i] = a[j];
				break;
			}
		}
	}
	printf("0 ");
	for(int i=1; i<=N; i++) printf("%d ",a[i]);
	return 0;
}

Compilation message

carnival.cpp: In function 'void query(int, int, int)':
carnival.cpp:24:25: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
  printf("%d ",tmp.size());
                         ^
carnival.cpp: In function 'int main()':
carnival.cpp:42:16: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);
                ^
carnival.cpp:48:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&tmp);
                   ^
carnival.cpp:55:20: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&tmp);
                    ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2020 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2020 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2020 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2020 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 0 ms 2020 KB Execution timed out (wall clock limit exceeded)
2 Halted 0 ms 0 KB -