QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#117074#6668. Trokutiyoungsystem#0 11ms5968kbC++204.3kb2023-06-30 12:49:282024-05-31 18:40:44

Judging History

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

  • [2024-05-31 18:40:44]
  • 评测
  • 测评结果:0
  • 用时:11ms
  • 内存:5968kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 12:49:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
inline int read()
{
	int n=0,f=1,ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')
	{
		n=n*10+ch-'0';
		ch=getchar();
	}
	return n*f;
}
int ans[105][105][105];
int sc[105][105];
int yl[105][105];
int p[1005];
mt19937 ran(114519);
int xl1[1005],cnt1;
int xl2[1005],cnt2;
int wz[1005],tmp;
int fa[2005],nqd[2005];
int findf(int n)
{
	if(fa[n]==n)return n;
	return fa[n]=findf(fa[n]);
}
void merge(int x,int y)
{
	x=findf(x);
	y=findf(y);
	fa[x]=y;
}
int qsl;
int ask(int i,int j,int k)
{
	qsl++;
	assert(qsl<=100000);
	printf("? %d %d %d\n",i,j,k);
	fflush(stdout);
	int ans=read();
	return ans;
}
int main()
{
	/*for(int i=1;i<=100;i++)
	{
		for(int j=i+1;j<=100;j++)
		{
			yl[i][j]=ran()%2;
			yl[j][i]=yl[i][j];
		}
	}*/
	int n=7;
	for(int i=1;i<=100;i++)p[i]=i;
	for(int i=1;i<=100;i++)swap(p[ran()%i+1],p[i]);
	for(int i=2;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			ans[p[1]][p[i]][p[j]]=ask(p[1],p[i],p[j]);
			ans[p[1]][p[j]][p[i]]=ans[p[1]][p[i]][p[j]]; 
		}
	}
	for(int i=2;i<=n;i++)
	{
		cnt1=cnt2=0;
		bool qd=false;
		for(int j=2;j<=n;j++)
		{
			if(j==i)continue;
			if(ans[p[1]][p[i]][p[j]]==0)
			{
				qd=true;
				sc[p[1]][p[i]]=0;
				break;
			}
			if(ans[p[1]][p[i]][p[j]]==3)
			{
				qd=true;
				sc[p[1]][p[i]]=1;
				break;
			}
			if(ans[p[1]][p[i]][p[j]]==1)xl1[++cnt1]=j;
			else xl2[++cnt2]=j;
		}
		if(qd)continue;
		if(cnt1>=3)
		{
			int sth=ask(p[xl1[1]],p[xl1[2]],p[xl1[3]]);
			if(sth!=0)
			{
				sc[p[1]][p[i]]=0;
				continue;
			}
			if(ans[p[1]][p[xl1[1]]][p[xl1[2]]]>=2)sc[p[1]][p[i]]=0;
			else sc[p[1]][p[i]]=1;
		}
		else
		{
			int sth=ask(p[xl2[1]],p[xl2[2]],p[xl2[3]]);
			if(sth!=3)
			{
				sc[p[1]][p[i]]=1;
				continue;
			}
			if(ans[p[1]][p[xl2[1]]][p[xl2[2]]]>=2)sc[p[1]][p[i]]=0;
			else sc[p[1]][p[i]]=1;
		}
	}
	for(int i=2;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			sc[p[i]][p[j]]=ans[p[1]][p[i]][p[j]]-sc[p[1]][p[i]]-sc[p[1]][p[j]];
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=i+1;j<=n;j++)
		{
			sc[p[j]][p[i]]=sc[p[i]][p[j]];
		}
	}
	n=100;
	for(int i=8;i<=n;i++)
	{
		for(int j=1;j<=2*(i-1);j++)
		{
			fa[j]=j;
			nqd[j]=-1;
		}
		int x,y;
		while(1)
		{
			tmp=0;
			for(int j=1;j<=(i-1);j++)
			{
				if(findf(j)==j&&nqd[j]==-1)wz[++tmp]=j;
			}
			//printf("!!!%d\n",tmp);
			if(tmp==0)break;
			if(tmp>=2)
			{
				int x=ran()%tmp+1,y=ran()%tmp+1;
				while(x==y)
				{
					x=ran()%tmp+1;
					y=ran()%tmp+1;
				}
				//printf("orz%d %d %d\n",x,y,tmp);
				int sth=ask(p[i],p[wz[x]],p[wz[y]])-sc[p[wz[x]]][p[wz[y]]];
				//printf("%d %d %d\n",wz[x],wz[y],sth);
				if(sth==0)
				{
					merge(wz[x],wz[y]);
					merge(wz[x]+i-1,wz[y]+i-1);
					nqd[findf(wz[x])]=0;
					nqd[findf(wz[x]+i-1)]=1;
				}
				else if(sth==2)
				{
					merge(wz[x],wz[y]);
					merge(wz[x]+i-1,wz[y]+i-1);
					nqd[findf(wz[x])]=1;
					nqd[findf(wz[x]+i-1)]=0;
				}
				else
				{
					merge(wz[x],wz[y]+i-1);
					merge(wz[x]+i-1,wz[y]);
				}
			}
			else
			{
				tmp=0;
				for(int j=1;j<=i-1;j++)
				{
					if(findf(j)<=i-1&&nqd[findf(j)]==-1)wz[++tmp]=j;
				}
				int gre=0;
				for(int j=1;j<=i-1;j++)
				{
					if(nqd[findf(j)]!=-1)gre=j;
				}
				if(gre!=0)
				{
					int sth=ask(p[i],p[wz[1]],p[gre])-sc[p[wz[1]]][p[gre]]-nqd[findf(gre)];
					if(sth==0)
					{
						nqd[findf(wz[1])]=0;
						nqd[findf(wz[1]+i-1)]=1;
					}
					else
					{
						nqd[findf(wz[1])]=1;
						nqd[findf(wz[1]+i-1)]=0;
					}
					break;
				}
				if(tmp<=1)
				{
					tmp=0;
					for(int j=1;j<=i-1;j++)
					{
						if(findf(j)>i-1&&nqd[findf(j)]==-1)wz[++tmp]=j;
					}
				}
				int sth=ask(p[i],p[wz[1]],p[wz[2]])-sc[p[wz[1]]][p[wz[2]]];
				if(sth==2)
				{
					nqd[findf(wz[1])]=1;
					nqd[findf(wz[1]+i-1)]=0;
				}
				else
				{
					nqd[findf(wz[1])]=0;
					nqd[findf(wz[1]+i-1)]=1;
				}
				break; 
			}
		}
		for(int j=1;j<=i-1;j++)
		{
			if(nqd[findf(j)]==1)sc[p[i]][p[j]]=sc[p[j]][p[i]]=1;
			else sc[p[i]][p[j]]=sc[p[j]][p[i]]=0;
		}
	}
	printf("!\n");
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			printf("%d",sc[i][j]);
		}
		printf("\n");
	}
	fflush(stdout);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 100
Accepted
time: 10ms
memory: 5968kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 12 34 9
? 12 34 55
? 12 34 59
? 12 34 63
? 12 34 26
? 12 9 55
? 12 9 59
? 12 9 63
? 12 9 26
? 12 55 59
? 12 55 63
? 12 55 26
? 12 59 63
? 12 59 26
? 12 63 26
? 68 34 59
? 68 9 26
? 68 55 63
? 68 12 26
? 96 55 68
? 96 9 34
? 96 12 26
? 96 63 59
? 42 96 55
? 42 9 34
? 42 68 12
? 42 26 63
? 42 59 96
...

result:

points 1.0 points  1.0 correct 2503 queries

Test #2:

score: 100
Accepted
time: 0ms
memory: 3924kb

input:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

output:

? 12 34 9
? 12 34 55
? 12 34 59
? 12 34 63
? 12 34 26
? 12 9 55
? 12 9 59
? 12 9 63
? 12 9 26
? 12 55 59
? 12 55 63
? 12 55 26
? 12 59 63
? 12 59 26
? 12 63 26
? 68 34 59
? 68 9 26
? 68 55 63
? 68 12 26
? 96 55 68
? 96 9 34
? 96 12 26
? 96 63 59
? 42 96 55
? 42 9 34
? 42 68 12
? 42 26 63
? 42 59 96
...

result:

points 1.0 points  1.0 correct 2503 queries

Test #3:

score: 100
Accepted
time: 0ms
memory: 3856kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 12 34 9
? 12 34 55
? 12 34 59
? 12 34 63
? 12 34 26
? 12 9 55
? 12 9 59
? 12 9 63
? 12 9 26
? 12 55 59
? 12 55 63
? 12 55 26
? 12 59 63
? 12 59 26
? 12 63 26
? 68 34 59
? 68 9 26
? 68 55 63
? 68 12 26
? 96 55 68
? 96 9 34
? 96 12 26
? 96 63 59
? 42 96 55
? 42 9 34
? 42 68 12
? 42 26 63
? 42 59 96
...

result:

points 1.0 points  1.0 correct 2503 queries

Test #4:

score: 100
Accepted
time: 11ms
memory: 5880kb

input:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

output:

? 12 34 9
? 12 34 55
? 12 34 59
? 12 34 63
? 12 34 26
? 12 9 55
? 12 9 59
? 12 9 63
? 12 9 26
? 12 55 59
? 12 55 63
? 12 55 26
? 12 59 63
? 12 59 26
? 12 63 26
? 68 34 59
? 68 9 26
? 68 55 63
? 68 12 26
? 96 55 68
? 96 9 34
? 96 12 26
? 96 63 59
? 42 96 55
? 42 9 34
? 42 68 12
? 42 26 63
? 42 59 96
...

result:

points 1.0 points  1.0 correct 2503 queries

Test #5:

score: 100
Accepted
time: 6ms
memory: 3880kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

? 12 34 9
? 12 34 55
? 12 34 59
? 12 34 63
? 12 34 26
? 12 9 55
? 12 9 59
? 12 9 63
? 12 9 26
? 12 55 59
? 12 55 63
? 12 55 26
? 12 59 63
? 12 59 26
? 12 63 26
? 68 34 59
? 68 9 26
? 68 55 63
? 68 12 26
? 96 55 68
? 96 9 34
? 96 12 26
? 96 63 59
? 42 96 55
? 42 9 34
? 42 68 12
? 42 26 63
? 42 59 96
...

result:

points 1.0 points  1.0 correct 2513 queries

Test #6:

score: 100
Accepted
time: 0ms
memory: 3932kb

input:

3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
...

output:

? 12 34 9
? 12 34 55
? 12 34 59
? 12 34 63
? 12 34 26
? 12 9 55
? 12 9 59
? 12 9 63
? 12 9 26
? 12 55 59
? 12 55 63
? 12 55 26
? 12 59 63
? 12 59 26
? 12 63 26
? 68 34 59
? 68 9 26
? 68 55 63
? 68 12 26
? 96 55 68
? 96 9 34
? 96 12 26
? 96 63 59
? 42 96 55
? 42 9 34
? 42 68 12
? 42 26 63
? 42 59 96
...

result:

points 1.0 points  1.0 correct 2510 queries

Test #7:

score: 100
Accepted
time: 8ms
memory: 3984kb

input:

2
1
1
1
2
2
1
2
2
0
0
2
0
1
2
0
0
1
0
0
0
1
1
2
1
0
2
0
0
1
1
0
0
1
0
1
1
1
2
1
2
0
1
1
1
1
0
3
1
1
2
1
2
0
1
2
0
0
0
0
0
2
1
2
0
0
2
1
2
1
2
2
1
0
2
1
0
1
1
1
1
1
2
2
0
0
0
0
0
0
1
1
0
0
0
1
0
2
1
1
0
0
0
1
2
1
2
0
0
1
2
1
0
2
0
3
0
1
1
0
1
0
0
1
0
2
0
1
1
1
1
2
0
1
1
2
1
1
1
2
0
1
1
1
1
0
2
1
1
1
...

output:

? 12 34 9
? 12 34 55
? 12 34 59
? 12 34 63
? 12 34 26
? 12 9 55
? 12 9 59
? 12 9 63
? 12 9 26
? 12 55 59
? 12 55 63
? 12 55 26
? 12 59 63
? 12 59 26
? 12 63 26
? 55 59 63
? 34 55 63
? 34 9 55
? 68 34 59
? 68 9 26
? 68 55 63
? 68 12 26
? 96 55 68
? 96 63 9
? 96 26 9
? 96 68 34
? 96 9 12
? 96 59 12
? ...

result:

points 1.0 points  1.0 correct 3136 queries

Test #8:

score: 0
Wrong Answer
time: 3ms
memory: 5968kb

input:

1
1
1
0
1
1
0
1
0
1
2
1
0
1
1
2
2
1
1
2
0
1
2
1
2
2
2
2
3
1
0
0
1
2
1
0
0
2
2
1
0
1
1
1
0
1
0
0
1
1
1
2
1
0
0
1
0
1
0
2
2
2
0
1
1
0
1
1
2
2
0
0
2
0
1
0
1
0
0
1
1
0
0
2
1
1
0
1
2
1
1
2
1
1
1
2
2
0
2
0
1
1
1
3
2
1
2
0
0
1
1
2
0
1
2
1
1
1
2
2
0
2
3
1
2
1
0
1
0
0
0
2
1
1
0
2
1
0
1
1
2
0
2
0
1
1
0
0
1
0
...

output:

? 12 34 9
? 12 34 55
? 12 34 59
? 12 34 63
? 12 34 26
? 12 9 55
? 12 9 59
? 12 9 63
? 12 9 26
? 12 55 59
? 12 55 63
? 12 55 26
? 12 59 63
? 12 59 26
? 12 63 26
? 34 9 59
? 68 34 59
? 68 59 9
? 68 9 26
? 68 26 63
? 68 63 12
? 68 55 26
? 96 59 55
? 96 68 34
? 96 63 26
? 96 12 55
? 96 26 34
? 96 9 34
?...

result:

wrong answer Token parameter [name=ans_i] equals to "001010111010001010010111111000...0010000111111110101100110010100", doesn't correspond to pattern "[01]{100,100}"