답안 #168817

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168817 2019-12-16T15:05:35 Z songc 사육제 (CEOI14_carnival) C++14
100 / 100
32 ms 376 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long LL;

int N, num=1;
int P[220], A[220];

int main(){
	scanf("%d", &N);
	for (int i=1; i<N; i++){
		int L=i+1, H=N;
		while (L<=H){
			int mid = (L+H)/2, ret1, ret2;
			printf("%d", mid-i+1);
			for (int j=i; j<=mid; j++) printf(" %d", j);
			cout<<endl;
			scanf("%d", &ret1);

			printf("%d", mid-i);
			for (int j=i+1; j<=mid; j++) printf(" %d", j);
			cout<<endl;
			scanf("%d", &ret2);

			if (ret1 == ret2) P[i] = mid, H = mid-1;
			else L = mid+1;
		}
	}
	printf("0");
	for (int i=1; i<=N; i++){
		if (A[i] == 0) A[i] = num++;
		A[P[i]] = A[i];
		printf(" %d", A[i]);
	}
	printf("\n");
	return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
carnival.cpp:18:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &ret1);
    ~~~~~^~~~~~~~~~~~~
carnival.cpp:23:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d", &ret2);
    ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 376 KB Output is correct
2 Correct 22 ms 376 KB Output is correct
3 Correct 27 ms 376 KB Output is correct
4 Correct 18 ms 248 KB Output is correct
5 Correct 17 ms 248 KB Output is correct
6 Correct 18 ms 376 KB Output is correct
7 Correct 25 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 248 KB Output is correct
2 Correct 19 ms 248 KB Output is correct
3 Correct 17 ms 248 KB Output is correct
4 Correct 28 ms 248 KB Output is correct
5 Correct 21 ms 376 KB Output is correct
6 Correct 12 ms 248 KB Output is correct
7 Correct 12 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 248 KB Output is correct
2 Correct 21 ms 376 KB Output is correct
3 Correct 27 ms 376 KB Output is correct
4 Correct 25 ms 248 KB Output is correct
5 Correct 23 ms 252 KB Output is correct
6 Correct 13 ms 252 KB Output is correct
7 Correct 19 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 376 KB Output is correct
2 Correct 23 ms 248 KB Output is correct
3 Correct 31 ms 248 KB Output is correct
4 Correct 32 ms 376 KB Output is correct
5 Correct 27 ms 248 KB Output is correct
6 Correct 26 ms 376 KB Output is correct
7 Correct 26 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 248 KB Output is correct
2 Correct 24 ms 376 KB Output is correct
3 Correct 27 ms 248 KB Output is correct
4 Correct 22 ms 248 KB Output is correct
5 Correct 16 ms 376 KB Output is correct
6 Correct 29 ms 376 KB Output is correct
7 Correct 31 ms 248 KB Output is correct