답안 #160098

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
160098 2019-10-26T02:39:38 Z luciocf 사육제 (CEOI14_carnival) C++14
100 / 100
18 ms 504 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 155;

int ans[maxn];
int ind[maxn];

int main(void)
{
	int n;
	scanf("%d", &n);

	int c = 1;
	ans[1] = 1, ind[1] = 1;

	for (int i = 2; i <= n; i++)
	{
		int ini = 1, fim = c, cor = c+1;

		while (ini <= fim)
		{
			int mid = (ini+fim)>>1;

			printf("%d", mid+1);
			for (int j = 1; j <= mid; j++)
				printf(" %d", ind[j]);
			printf(" %d\n", i);
			fflush(stdout);

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

			if (res == mid) cor = mid, fim = mid-1;
			else ini = mid+1;
		}

		c = max(c, cor);
		ans[i] = cor, ind[cor] = i;
	}

	printf("0");
	for (int i = 1; i <= n; i++)
		printf(" %d", ans[i]);
	printf("\n");
	fflush(stdout);
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
carnival.cpp:33:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &res);
    ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 10 ms 376 KB Output is correct
3 Correct 14 ms 504 KB Output is correct
4 Correct 16 ms 248 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 10 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 12 ms 376 KB Output is correct
3 Correct 11 ms 248 KB Output is correct
4 Correct 16 ms 252 KB Output is correct
5 Correct 4 ms 248 KB Output is correct
6 Correct 4 ms 248 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 11 ms 248 KB Output is correct
4 Correct 18 ms 248 KB Output is correct
5 Correct 4 ms 248 KB Output is correct
6 Correct 8 ms 376 KB Output is correct
7 Correct 12 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 17 ms 248 KB Output is correct
4 Correct 17 ms 376 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 12 ms 248 KB Output is correct
7 Correct 10 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 248 KB Output is correct
2 Correct 9 ms 252 KB Output is correct
3 Correct 13 ms 376 KB Output is correct
4 Correct 15 ms 376 KB Output is correct
5 Correct 12 ms 252 KB Output is correct
6 Correct 15 ms 248 KB Output is correct
7 Correct 11 ms 252 KB Output is correct