답안 #25921

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25921 2017-06-25T06:21:25 Z kriii 사육제 (CEOI14_carnival) C++14
0 / 100
6 ms 1172 KB
#include <stdio.h>
#include <vector>
using namespace std;

vector<int> pos;
int num[155], col[155], C;

int main()
{
	int N; scanf ("%d",&N);
	for (int i=1;i<N;i++){
		printf ("%d",N-i+1);
		for (int j=i;j<=N;j++) printf (" %d",j); puts(""); fflush(stdout);
		scanf ("%d",num+i);
	}
	num[N] = 1;

	for (int i=1;i<=N;i++) if (num[i] != num[i+1]){
		col[i] = ++C;
		pos.push_back(i);
	}

	for (int i=1;i<=N;i++) if (!col[i]){
		while (pos[0] < i) pos.erase(pos.begin());
		int l = 0, r = pos.size(), a = pos.size();
		while (l + 1 < r){
			int m = (l + r) / 2;
			printf ("%d",pos.size()-m+1);
			for (int i=m;i<pos.size();i++) printf (" %d",pos[i]);
			printf (" %d\n",i); fflush(stdout);

			int c; scanf ("%d",&c);
			if (c == r - m + 1) r = m;
			else l = m;
		}
		col[i] = col[pos[l]];
	}

	printf ("0");
	for (int i=1;i<=N;i++) printf (" %d",col[i]); puts(""); fflush(stdout);

	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:28:31: 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",pos.size()-m+1);
                               ^
carnival.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i=m;i<pos.size();i++) printf (" %d",pos[i]);
                  ^
carnival.cpp:25:30: warning: unused variable 'a' [-Wunused-variable]
   int l = 0, r = pos.size(), a = pos.size();
                              ^
carnival.cpp:10:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int N; scanf ("%d",&N);
                        ^
carnival.cpp:14:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%d",num+i);
                     ^
carnival.cpp:32:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    int c; scanf ("%d",&c);
                          ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1172 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1172 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1172 KB Output is correct
2 Incorrect 3 ms 1172 KB Incorrect
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1172 KB Incorrect
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1172 KB Output is correct
2 Incorrect 6 ms 1172 KB Incorrect
3 Halted 0 ms 0 KB -