Submission #168817

#TimeUsernameProblemLanguageResultExecution timeMemory
168817songcCarnival (CEOI14_carnival)C++14
100 / 100
32 ms376 KiB
#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 (stderr)

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);
    ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...