QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#117623#6668. Trokutivme500 20ms3620kbC++172.1kb2023-07-01 20:49:022023-07-01 20:49:03

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-01 20:49:03]
  • 评测
  • 测评结果:0
  • 用时:20ms
  • 内存:3620kb
  • [2023-07-01 20:49:02]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define N 105
#define MOD 998244353
mt19937 rand1(0);
int n=100,nw,w[N],rt[N],st[N],a[N][N],z[N][N];
int f(int x,int y) {return (x-1)*(x-2)/2+y;}
int rdm(int l,int r) {return uniform_int_distribution<int>(l,r)(rand1);}
int qry(int x1,int x2,int x3)
{printf("? %d %d %d\n",x1,x2,x3);fflush(stdout);int t;scanf("%d",&t);return t;}
int findRt(int u)
{if(u==rt[u]) return u;int t=findRt(rt[u]);w[u]^=w[rt[u]];return rt[u]=t;}
void W(int &x,int y) {x+=y;if(x>=MOD) x-=MOD;}
int qPow(int x,int y)
{int res=1;for(;y;y/=2,x=1ll*x*x%MOD) if(y&1) res=1ll*res*x%MOD;return res;}
void Gauss(int n)
{
	for(int i=1,t,t1;i<=n;++i)
	{
		if(!a[i][i]) for(int j=i+1;j<=n;++j) if(a[j][i])
		{for(int k=i;k<=n+1;++k) swap(a[i][k],a[j][k]);break;}
		assert(a[i][i]);t=qPow(MOD-a[i][i],MOD-2);
		for(int j=i+1;j<=n;++j)
		{
			t1=1ll*t*a[j][i]%MOD;
			for(int k=i;k<=n+1;++k) a[j][k]=(a[j][k]+1ll*t1*a[i][k])%MOD;
		}
	}
	for(int i=n;i;--i)
	{
		for(int j=i+1;j<=n;++j) W(a[i][n+1],MOD-1ll*a[i][j]*a[j][n+1]%MOD);
		a[i][n+1]=1ll*a[i][n+1]*qPow(a[i][i],MOD-2)%MOD;
	}
}
int main()
{
	for(int i=1;i<=5;++i) for(int j=1;j<i;++j) for(int k=1;k<j;++k)
		++nw,a[nw][f(i,j)]=a[nw][f(j,k)]=a[nw][f(i,k)]=1,a[nw][11]=qry(i,j,k);
	Gauss(10);for(int i=1;i<=5;++i) for(int j=1;j<i;++j) z[i][j]=a[f(i,j)][11];
	for(int i=6,t,t1,t2;i<=n;++i)
	{
		iota(rt+1,rt+i,1);fill(w+1,w+i,0);fill(z[i]+1,z[i]+i,-1);
		while(1)
		{
			st[0]=0;for(int j=1;j<i;++j) if(findRt(j)==j && z[i][j]==-1) st[++st[0]]=j;
			if(!st[0]) break;
			if(st[0]==1)
			{
				if(st[1]>1) z[i][st[1]]=qry(i,1,st[1])-z[st[1]][1]-z[i][1];
				else z[i][1]=qry(i,1,2)-z[2][1]-z[i][2];break;
			}t1=t2=st[rdm(1,st[0])];while(t1==t2) t2=st[rdm(1,st[0])];
			t=qry(i,t1,t2)-z[max(t1,t2)][min(t1,t2)];
			if(t==1) rt[t1]=t2,w[t1]=1;else z[i][t1]=z[i][t2]=t/2;
		}for(int j=1;j<i;++j) if(z[i][j]==-1) t=findRt(j),z[i][j]=z[i][t]^w[j];
	}for(int i=1;i<=n;++i) for(int j=1;j<i;++j) z[j][i]=z[i][j];putchar('!');
	for(int i=1;i<=n;++i,putchar('\n')) for(int j=1;j<=n;++j) putchar(z[i][j]+48);
	fflush(stdout);return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 20ms
memory: 3620kb

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:

? 3 2 1
? 4 2 1
? 4 3 1
? 4 3 2
? 5 2 1
? 5 3 1
? 5 3 2
? 5 4 1
? 5 4 2
? 5 4 3
? 6 3 4
? 6 5 2
? 6 1 2
? 7 6 4
? 7 5 2
? 7 3 1
? 8 4 3
? 8 7 1
? 8 6 2
? 8 1 5
? 9 4 7
? 9 6 5
? 9 2 3
? 9 1 8
? 10 8 1
? 10 4 2
? 10 7 3
? 10 6 9
? 10 1 5
? 11 10 8
? 11 2 7
? 11 9 4
? 11 6 3
? 11 5 1
? 12 8 7
? 12 2 5...

result:

wrong answer unknown token !0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000