QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#93403 | #21608. 行列式 | myee# | Compile Error | / | / | C++11 | 2.6kb | 2023-03-31 19:44:29 | 2023-03-31 19:44:31 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-03-31 19:44:31]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-03-31 19:44:29]
- 提交
answer
// 那就是希望。
// 即便需要取模,也是光明。
#include <algorithm>
#include <stdio.h>
#include <vector>
typedef long long llt;
typedef unsigned uint;typedef unsigned long long ullt;
typedef bool bol;typedef char chr;typedef void voi;
typedef double dbl;
template<typename T>bol _max(T&a,T b){return(a<b)?a=b,true:false;}
template<typename T>bol _min(T&a,T b){return(b<a)?a=b,true:false;}
template<typename T>T lowbit(T n){return n&-n;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T lcm(T a,T b){return(a!=0||b!=0)?a/gcd(a,b)*b:(T)0;}
template<typename T>T exgcd(T a,T b,T&x,T&y){if(b!=0){T ans=exgcd(b,a%b,y,x);y-=a/b*x;return ans;}else return y=0,x=1,a;}
template<typename T>T power(T base,T index,T mod)
{
T ans=1%mod;
while(index)
{
if(index&1)ans=ans*base%mod;
base=base*base%mod,index>>=1;
}
return ans;
}
const ullt Mod=998244353;
struct modint
{
ullt v;
modint():v(0){}
modint(ullt v):v(v%Mod){}
voi read(){scanf("%llu",&v);}
voi print(){printf("%llu",v);}
voi println(){print(),putchar('\n');}
ullt&operator()(){return v;}
friend modint operator+(modint a,modint b){return a()+b();}
friend modint operator-(modint a,modint b){return a()+Mod-b();}
friend modint operator*(modint a,modint b){return a()*b();}
friend modint operator/(modint a,modint b){return a*b.inv();}
friend modint operator^(modint a,ullt b){
modint ans(1);
while(b){
if(b&1)ans*=a;
a*=a,b>>=1;
}
return ans;
}
modint inv(){return(*this)^(Mod-2);}
modint&operator+=(modint b){return*this=*this+b;}
modint&operator-=(modint b){return*this=*this-b;}
modint&operator*=(modint b){return*this=*this*b;}
modint&operator/=(modint b){return*this=*this/b;}
modint&operator^=(ullt b){return*this=(*this)^b;}
};
modint A[505][505];
uint n;
modint det(){
modint ans(1);
for(uint i=0;i<n;i++){
for(uint j=i+1;j<n;j++)if(A[j][i]()){
for(uint k=i;k<n;k++)std::swap(A[i][k],A[j][k]);
ans=-ans;
break;
}
if(!A[i][i]())return 0;
ans*=A[i][i],A[i][i]=A[i][i].inv();
for(uint j=i+1;j<n;j++)A[i][j]*=A[i][i];
for(uint j=i+1;j<n;j++)for(uint k=i+1;k<n;k++)
A[j][k]-=A[j][i]*A[i][k];
}
return ans;
}
int main()
{
#ifdef MYEE
freopen("QAQ.in","r",stdin);
freopen("QAQ.out","w",stdout);
#endif
scanf("%u",&n);
for(uint i=0;i<n;i++)for(uint j=0;j<n;j++)A[i][j].read();
det().println();
return 0;
}
// 那就是希望。
// 即便需要取模,也是光明。
/*
g++ code.cpp -o code -std=c++14 -Wall -fsanitize=undefined,address -DMYEE
*/
詳細信息
answer.code: In function ‘modint det()’: answer.code:63:29: error: no match for ‘operator-’ (operand type is ‘modint’) 63 | ans=-ans; | ^~~~ answer.code:38:23: note: candidate: ‘modint operator-(modint, modint)’ 38 | friend modint operator-(modint a,modint b){return a()+Mod-b();} | ^~~~~~~~ answer.code:38:23: note: candidate expects 2 arguments, 1 provided answer.code: In function ‘int main()’: answer.code:80:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 80 | scanf("%u",&n); | ~~~~~^~~~~~~~~ answer.code: In member function ‘voi modint::read()’: answer.code:33:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | voi read(){scanf("%llu",&v);} | ~~~~~^~~~~~~~~~~