QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#548246 | #6347. XOR Determinant | BFSDFS123# | Compile Error | / | / | C++14 | 1.1kb | 2024-09-05 16:34:49 | 2024-09-05 16:34:50 |
Judging History
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;
}
Details
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); | ~~~~~^~~~~~~~~~~