QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#548246#6347. XOR DeterminantBFSDFS123#Compile Error//C++141.1kb2024-09-05 16:34:492024-09-05 16:34:50

Judging History

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

  • [2024-09-05 16:34:50]
  • 评测
  • [2024-09-05 16:34:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
const int Mod=998244353;
const int Maxn=5010;
int qpow(int a,int b=Mod-2)
{
	a=(a%Mod+Mod)%Mod;
	int res=1;
	while(b)
	{
		if(b&1)
		{
			res=res*a%Mod;
		}
		a=a*a%Mod;
		b>>=1;
	}
	return res;
}
int a[Maxn],b[Maxn];
int n;
int C[Maxn][Maxn];

int work()
{
	int ans=1;
	for(int i=1;i<=n;i++)
	{
		for(int j=i;j<=n;j++)
		{
			if(C[j][i])
			{
				if(j!=i) ans=-ans;
				swap(C[i],C[j]);break;
			}
		}
		if(!C[i][i]) return 0;
		int inv=qpow(C[i][i]);
		for(int j=i+1;j<=n;j++)
		{
			int t=inv*C[j][i]%Mod;
			for(int k=i;k<=n;k++)
			{
				C[j][k]=(C[j][k]-t*C[i][k])%Mod;
			}
		}
		
		ans=ans*C[i][i]%Mod;
	} 
	
	return (ans%Mod+Mod)%Mod;
}
void solve()
{
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			C[i][j]=a[i]^b[j];
//	if(n>61) puts("0");
	else printf("%lld\n",work());
}
signed main()
{
	int T;
	scanf("%lld",&T);
	while(T--)
	{
		solve();
	}
	return 0;
}

详细

answer.code: In function ‘void solve()’:
answer.code:64:9: error: ‘else’ without a previous ‘if’
   64 |         else printf("%lld\n",work());
      |         ^~~~
answer.code:57:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   57 |         scanf("%lld",&n);
      |         ~~~~~^~~~~~~~~~~
answer.code:58:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   58 |         for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
      |                               ~~~~~^~~~~~~~~~~~~~
answer.code:59:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   59 |         for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
      |                               ~~~~~^~~~~~~~~~~~~~
answer.code: In function ‘int main()’:
answer.code:69:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   69 |         scanf("%lld",&T);
      |         ~~~~~^~~~~~~~~~~