Submission #168814

# Submission time Handle Problem Language Result Execution time Memory
168814 2019-12-16T15:02:57 Z songc Carnival (CEOI14_carnival) C++14
0 / 100
24 ms 380 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);
    ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 20 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 248 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 376 KB Output is correct
2 Incorrect 24 ms 380 KB Incorrect
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 376 KB Incorrect
2 Halted 0 ms 0 KB -