QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#342958#21608. 行列式RoFtaCD#Compile Error//C++14900b2024-03-01 20:09:062024-03-01 20:09:08

Judging History

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

  • [2024-03-01 20:09:08]
  • 评测
  • [2024-03-01 20:09:06]
  • 提交

answer

#include <bits/stdc++.h>
#define each(i,a,b) for(int i=(a);i<=(b);++i)
#define eachr(i,a,b) for(int i=(a);i>=(b);--i)

using namespace std;
typedef long long ll;
const int N=625,p=998244353;

inline int rd(){
    int w=1,r=0;char c=getchar();
    while(!isdigit(c)) (c=='-')and(w=-1),c=getchar();
    while(isdigit(c)) r=r*10+(c^48),c=getchar();
    return r*w;
}
int n,p,a[N][N];

int det(){
    int res=1;
    each(i,1,n){
        each(j,i+1,n){
            while(a[i][i]){
                int d=a[j][i]/a[i][i];
                each(k,i,n) a[j][k]=(a[j][k]-1ll*d*a[i][k]%p+p)%p;
                swap(a[i],a[j]),res*=-1;
            }
            swap(a[i],a[j]),res*=-1;
        }
    }
    each(i,1,n) res=1ll*res*a[i][i]%p;
    return (res+p)%p;
}

int main(){
    n=rd();
    each(i,1,n) each(j,1,n) a[i][j]=rd()%p;
    printf("%d\n",det());
    return 0;
}

詳細信息

answer.code:15:7: error: conflicting declaration ‘int p’
   15 | int n,p,a[N][N];
      |       ^
answer.code:7:17: note: previous declaration as ‘const int p’
    7 | const int N=625,p=998244353;
      |                 ^