답안 #116780

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
116780 2019-06-13T19:56:44 Z ioilolcom 사육제 (CEOI14_carnival) C++14
100 / 100
20 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int N=200;
int P[N],an[N];
int cnt;
int query(int e,int a){
	if(a<=e) {
		cout<<e<<" ";
		for(int i=1; i<=e; i++) {
			cout<<i<<" ";
		}
		cout<<endl;
		fflush(stdout);
	}
	else{
		cout<<e+1<<" ";
		for(int i=1; i<=e; i++) {
			cout<<i<<" ";
		}
		cout<<a<<endl;
		fflush(stdout);
	}
	int cur;
	cin>>cur;
	return cur;
}
int main()
{
	int n; cin>>n;
	for(int i=1; i<=n; i++) {
		P[i]=query(i,0);
	}
	for(int i=1; i<=n; i++) {
		int l=1; int r=i;
		int ans=i;
		while(l<=r) {
			int mid=(l+r)/2;
			if(P[mid]==query(mid,i)) {
				r=mid-1;
				ans=mid;
			}
			else{
				l=mid+1;
			}
		}
		if(ans!=i) {
			an[i]=an[ans];
		}
		else{
			an[i]=++cnt;
		}
	}
	cout<<0<<" ";
	for(int i=1; i<=n; i++) {
		cout<<an[i]<<" ";
	}
	cout<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 256 KB Output is correct
2 Correct 18 ms 256 KB Output is correct
3 Correct 14 ms 256 KB Output is correct
4 Correct 16 ms 256 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
6 Correct 12 ms 256 KB Output is correct
7 Correct 10 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 384 KB Output is correct
2 Correct 13 ms 384 KB Output is correct
3 Correct 10 ms 256 KB Output is correct
4 Correct 9 ms 284 KB Output is correct
5 Correct 11 ms 384 KB Output is correct
6 Correct 9 ms 256 KB Output is correct
7 Correct 7 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 384 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 13 ms 256 KB Output is correct
4 Correct 14 ms 256 KB Output is correct
5 Correct 12 ms 384 KB Output is correct
6 Correct 11 ms 256 KB Output is correct
7 Correct 15 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 256 KB Output is correct
2 Correct 12 ms 256 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 11 ms 256 KB Output is correct
5 Correct 15 ms 384 KB Output is correct
6 Correct 10 ms 256 KB Output is correct
7 Correct 14 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 304 KB Output is correct
2 Correct 15 ms 304 KB Output is correct
3 Correct 17 ms 256 KB Output is correct
4 Correct 10 ms 256 KB Output is correct
5 Correct 9 ms 512 KB Output is correct
6 Correct 19 ms 256 KB Output is correct
7 Correct 20 ms 384 KB Output is correct