记录编号 436763 评测结果 AAAAAAAAAA
题目名称 [FHZOI 2017]映射关系 最终得分 100
用户昵称 Gravatar泪寒之雪 是否通过 通过
代码语言 C++ 运行时间 0.035 s
提交时间 2017-08-12 16:40:48 内存使用 0.48 MiB
显示代码纯文本
%:include <cmath>
%:include <cstdio>
%:include <cstring>
%:include <cstdlib>
%:include <algorithm>
using namespace std;class Interactive<%private:static const int _=10010;bool __;int ___;int ____<:_:>;int _____<:_:>;int ______<:100:>;int _____________;void _______()<%FILE* ________=fopen("Interactive.in","rb");fread(______,sizeof(int),100,________);fread(&_____________,sizeof(int),1,________);fread(_____+1,sizeof(int),_____________,________);fclose(________);%>void _________()<%for(int ___________=0,____________=1;____________<=_____________;____________++,___________=___________<99?___________+1:0)<%_____<:____________:>=_____<:____________:>^______<:___________:>;%>%>void ___________________________(int* ___________________)<%for(int ___________=0,____________=1;____________<=_____________;____________++,___________=___________<99?___________+1:0)<%___________________<:____________:>=___________________<:____________:>^______<:___________:>;%>%>void ______________(int* _______________)<%FILE* ________________=fopen("Interactive.out","wb");int _________________=0;fwrite(&_________________,sizeof(int),1,________________);fwrite(&_____________,sizeof(int),1,________________);fwrite(_______________+1,sizeof(int),_____________,________________);fwrite(&___,sizeof(int),1,________________);fclose(________________);%>public:int Initialize()<%int _________________=0xFFFFFFFF;if(__)exit(233);_______();_________();FILE* ________________=fopen("Interactive.out","wb");fwrite(&_________________,sizeof(int),1,________________);fclose(________________);__=true;return _____________;%>int* Quest(int* q)<%memset(____,0,sizeof(____));for(int ___________=1;___________<=q<:0:>;___________++)<%____<:___________-1:>=_____<:q<:___________:>:>;%>sort(____,____+q<:0:>);___++;return ____;%>void Submit(int* ___________________)<%___________________________(___________________);______________(___________________);exit(0);%>%>Inter;
#define N 10007
int quest[N],a[N],answer[N];
int* r;
int main() {
	int n=Inter.Initialize();
	if (n==1) {
		answer[1]=1;
		Inter.Submit(answer);
		return 0;
	}
	int lg=floor(log2(n))+1;
	int x;
	for(int i=0; i<=lg; i++) {
		x=0;
		for(int j=1; j<=n; j++) {
			if((j&(1<<i))!=0)
				quest[++x]=j;
		}
		quest[0]=x;
		if (x!=0)  r=Inter.Quest(quest);
		// for (int k=1;k<=x;k++)
		//r[k-1]=quest[k];
		for(int j=0; j<x; j++) {
			a[r[j]]+=(1<<i);
		}
	}
	for (int i=1; i<=n; i++)
		answer[a[i]]=i;
	Inter.Submit(answer);
	//for (int i=1;i<=n;i++)
	// printf("%d ",a[i]);
	return 0;
}