QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#622495 | #8821. Nightmare | Crysfly | WA | 553ms | 10956kb | C++14 | 5.4kb | 2024-10-08 22:08:16 | 2024-10-08 22:08:18 |
Judging History
answer
// what is matter? never mind.
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,sse4,popcnt,abm,mmx,avx,avx2")
#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define ll long long
#define ull unsigned long long
//#define int long long
#define SZ(x) ((int)((x).size()))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
return f?-x:x;
}
int mod;
struct modint{
unsigned int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x<o.x?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,modint b){return a.x==b.x;}
friend bool operator !=(modint a,modint b){return a.x!=b.x;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 2000005
#define inf 0x3f3f3f3f
int n;
modint g[505][505],res[505][505];
struct oper{
int op,i,j;
modint w;
};
vector<oper>qs;
void add(int i,int j,modint w){
qs.pb({1,i,j,w});
For(k,1,n) if(k!=i && k!=j) g[i][k]+=g[j][k]*w,g[k][i]+=g[k][j]*w;
g[i][i]+=(g[i][j]*w*2+g[j][j]*w*w);
g[i][j]+=g[j][j]*w;
g[j][i]+=g[j][j]*w;
}
void sw(int i,int j){
if(i==j)return;
qs.pb({0,i,j,0});
For(k,1,n) if(k!=i && k!=j) swap(g[i][k],g[j][k]),swap(g[k][i],g[k][j]);
swap(g[i][i],g[j][j]);
}
int sqr[maxn];
int p;
void out(){
reverse(ALL(qs));
for(auto [op,i,j,w]:qs){
if(op==0) swap(res[i],res[j]);
else{
For(k,1,p) res[i][k]-=res[j][k]*w;
}
}
cout<<p<<"\n";
For(i,1,n){
For(j,1,p)cout<<res[i][j].x<<" \n"[j==p];
}
exit(0);
}
signed main()
{
n=read(),mod=read();
For(i,1,n) For(j,1,n) g[i][j]=read();
For(i,0,mod) sqr[i]=-1;
For(i,0,mod-1){
modint t=i; t*=i;
sqr[t.x]=i;
}
bool flag=1;
int sums=0;
p=1;
while(1){
++sums;
if(sums>3000){
puts("????");
cout<<"flag,p "<<flag<<" "<<p<<"\n";
For(i,p,p+2)For(j,p,p+2)cout<<g[i][j].x<<" \n"[j==p+2];
exit(0);
}
bool ok=0;
For(i,p,n){
if(g[i][i].x){
sw(i,p);
modint I=1/g[p][p];
For(j,p+1,n) add(j,p,-I*g[j][p]);
++p; ok=1; break;
}
}
if(ok)continue;
auto find2=[&](){
For(i,p,n) For(j,i+1,n) if(g[i][j].x){
if(sums>2000) cout<<"find2 "<<i<<" "<<j<<"\n";
sw(i,p),sw(j,p+1);
return 1;
}
return 0;
};
if(!find2()) break;
if(mod>2){
add(p,p+1,1);
continue;
}
For(k,p+2,n){
if(g[p][k].x) add(k,p+1,1);
if(g[p+1][k].x) add(k,p,1);
}
if(p>1 && flag){
if(sums>2000){
For(k,p-1,p+1) For(kk,p-1,p+1) cout<<g[k][kk].x<<" \n"[kk==p+1]; puts("---");
}
add(p,p-1,1);
add(p+1,p-1,1);
add(p-1,p,1);
add(p-1,p+1,1);
if(sums>2000){
For(k,p-1,p+1) For(kk,p-1,p+1) cout<<g[k][kk].x<<" \n"[kk==p+1]; puts("---");
}
p-=1;
flag=1;
continue;
}
flag=0;
p+=2;
}
--p;
// For(i,1,n){
// For(j,1,n)cout<<g[i][j].x<<" ";
// cout<<"\n";
// }
if(mod==2 && !flag){
++p;
For(i,1,p-1){
For(j,1,i) res[i][j]=1;
res[i][p]=1;
if(i%2==0) res[i][i-1]=0;
}
out();
}
int z=0;
For(i,0,mod-1){
modint y=i; y*=i,y+=1;
if(sqr[y.x]==-1) z=i;
}
int lst=0;
For(i,1,p){
if(sqr[g[i][i].x]!=-1) res[i][i]=sqr[g[i][i].x];//cout<<"isok "<<i<<"\n";
else if(!lst) lst=i;
else {
int j=lst; lst=0;
res[i][i]=z;
res[j][j]=z;
res[i][j]=1;
res[j][i]=mod-1;
modint zz=sqr[(g[i][i]/(z*z+1)).x];
res[i][j]*=zz,res[i][i]*=zz;
zz=sqr[(g[j][j]/(z*z+1)).x];
res[j][j]*=zz,res[j][i]*=zz;
}
}
if(lst){
++p;
int i=lst;
res[i][i]=g[i][i];
res[i][p]=g[i][i]*z;
modint zz=sqr[(res[i][i]/(z*z+1)).x];
res[i][i]*=zz,res[i][p]*=zz;
}
// For(i,1,n) For(j,1,p) cout<<res[i][j].x<<" \n"[j==p];
out();
return 0;
}
/*
5 2
1 0 0 0 0
0 0 1 0 0
0 1 0 0 0
0 0 0 0 1
0 0 0 1 0
2 2
0 1
1 0
3 5
4 4 3
4 4 3
3 3 2
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 6456kb
input:
2 2 1 1 1 1
output:
1 1 1
result:
ok accepted
Test #2:
score: 0
Accepted
time: 0ms
memory: 6732kb
input:
3 5 4 4 3 4 4 3 3 3 2
output:
2 3 0 3 0 1 4
result:
ok accepted
Test #3:
score: 0
Accepted
time: 510ms
memory: 9284kb
input:
500 2 1 0 1 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 0 1 1 0 1 0 0 0 1 1 0 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 1 1 1 1 0 0 1 0 1 0 0 ...
output:
423 1 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 ...
result:
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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 ...
result:
ok accepted
Test #17:
score: 0
Accepted
time: 527ms
memory: 9176kb
input:
500 2 0 0 1 1 0 1 1 0 1 1 0 0 0 1 0 1 0 1 1 0 1 0 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 1 0 1 1 0 0 0 0 1 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 1 ...
output:
451 0 1 1 0 1 1 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 ...
result:
ok accepted
Test #18:
score: -100
Wrong Answer
time: 532ms
memory: 10956kb
input:
500 586939 348375 543104 2613 525830 529938 63001 57038 406207 446773 47968 73017 238901 268124 473469 570747 217880 286012 142821 179125 504343 438813 105553 332560 137383 123166 585260 335875 279206 541274 318826 12120 49682 487559 275080 491437 102596 71097 184988 184272 439469 251082 388754 2144...
output:
449 130917 130917 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 ...
result:
wrong answer wrong answer