QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#110444#2293. Boredom BusterPittowCompile Error//C++142.1kb2023-06-02 14:24:072023-06-02 14:41:46

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-02 14:41:46]
  • 评测
  • [2023-06-02 14:24:07]
  • 提交

answer

#include"galacticparagons.h"
#include<random>
std::mt19937 rd(80*86);
typedef std::vector<int> arr;
typedef std::pair<int,int> pa2;
int i,j,a[100086],A[100086];
int p[50086][2],c[50086];//group id
int s[100086],v[100086];//group mate,value mate
bool B[100086];//identified
pa2 ret;
inline void swap(int &a,int &b){
	int c=a;a=b;b=c;
}inline pa2 ask(int x,int y){
	pa2 ret=revealCards(A[x]+1,A[y]+1);
	--ret.first;--ret.second;
	return ret;
}inline void SWAP(int x){
	int y=s[x];
	swap(a[x],a[y]);
	swap(v[x],v[y]);
	swap(v[v[x]],v[v[y]]);
}void couple(int x){
	int y=s[x],z=v[x];
	bool g=0;
	while(ret=ask(x,g?y:z),ret.first!=ret.second)g=!g;
	int dx=a[x],dy=a[y];
	a[x]=a[g?y:z]=ret.first;
	if(dx==a[x])dx=dy;
	a[g?z:y]=dx;
	if(!B[z])a[s[z]]=dx;
	B[x]=B[y]=1;
	if(!B[z])B[z]=B[s[z]]=1;
}int luck(int x){
	int y=s[x],z=v[x],re;
	ret=ask(x,z);
	bool X=ret.first==a[y]||ret.second==a[y],Y=ret.first==a[s[z]]||ret.second==a[s[z]];
	if(Y)re=z;
	else re=s[v[s[z]]];
	if(X)SWAP(x);if(Y)SWAP(z);
	B[y]=B[s[z]]=1;
	if(ret.first==ret.second)B[x]=B[z]=1;
	else s[x]=z;s[z]=x;
	return re;
}
int L[100086],R[100086],S,T;
void reg(int x){L[T]=x;R[T++]=s[x];B[x]=B[s[x]]=1;}
void clear(){
	while(S+1<T){
		ret=ask(L[S],L[S+1]);
		if(ret.first==a[R[S]]||ret.second==a[R[S]])SWAP(L[S]);
		if(ret.first==a[R[S+1]]||ret.second==a[R[S+1]])SWAP(L[S+1]);
		B[R[S]]=B[R[S+1]]=1;
		s[L[S]]=L[S+1];s[L[S+1]]=L[S];
		reg(L[S]);S+=2;
	}if(S<T)couple(L[S]);
}arr guessCards(int n){
	arr ans(n);
	for(i=0;i<n;++i)A[i]=i,B[i]=0;
	//for(i=0;i<n;++i)swap(A[i],A[rd()%n]);//shuffle
	for(i=0;i+i<n;++i)c[i]=0;
	for(i=0;i<n;i+=2){
		ret=ask(i,i+1);
		a[i]=ret.first;
		a[i+1]=ret.second;
		p[a[i]][c[a[i]]++]=i;
		p[a[i+1]][c[a[i+1]]++]=i+1;
		s[i]=i+1;s[i+1]=i;
	}for(i=0;i+i<n;++i){
		v[p[i][0]]=p[i][1];
		v[p[i][1]]=p[i][0];
	}S=T=0;
	for(i=0;i<n;++i)if(!B[i]){
		if(s[i]==v[i])B[i]=B[s[i]]=1;
		else if(B[v[i]]&&B[v[s[i]]])reg(i);
		else if(s[v[i]]==v[s[i]])couple(i);
		else for(j=i--;!B[v[j]]&&!B[j]&&s[v[j]]!=v[s[j]];j=luck(j));
	}clear();
	for(i=0;i<n;++i)ans[A[i]]=a[i]+1;
	return ans;
}

詳細信息

answer.code:1:9: fatal error: galacticparagons.h: No such file or directory
    1 | #include"galacticparagons.h"
      |         ^~~~~~~~~~~~~~~~~~~~
compilation terminated.