QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#476461 | #2568. Mountains | msk_sama | WA | 1ms | 5312kb | C++23 | 1.6kb | 2024-07-13 19:43:17 | 2024-07-13 19:43:17 |
Judging History
answer
#include <bits/stdc++.h>
#define MISAKA main
#define ll long long
using namespace std;
inline int read(){
char ch=getchar();int f=1,x=0;
while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
return x*f;
}
const double eps=1e-9;
const ll N=310,inf=1e9,mod=1e9+7;
ll f[N],inv[N],n,m,k;
ll qpow(ll a,ll b){ll r=1;for(;b;b>>=1,a=a*a%mod)if(b&1)r=r*a%mod;return r;}
ll C(ll a,ll b){return a>=b?f[a]*inv[b]%mod*inv[a-b]%mod:0;}
struct matrix{
ll _m[N][N];
matrix(){memset(_m,0,sizeof(_m));}
ll det(){
ll res=1,a[N][N];
memcpy(a,_m,sizeof(_m));
for(int i=1;i<=k;i++){
for(int j=i+1;j<=k;j++){
while(a[i][i]){
ll t=a[j][i]/a[i][i];
for(int _k=1;_k<=k;_k++) a[j][_k]=(a[j][_k]-t*a[i][_k]%mod+mod)%mod;
swap(a[i],a[j]),res=-res;
}
swap(a[i],a[j]),res=-res;
}
}
for(int i=1;i<=k;i++) res=res*a[i][i]%mod;
return (res<0?res+mod:res);
}
}A;
signed MISAKA(){
f[0]=1;
for(ll i=1;i<=N-10;i++) f[i]=f[i-1]*i%mod;
inv[N-10]=qpow(f[N-10],mod-2);
for(ll i=N-11;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
n=read(),m=read(),k=read();
for(int i=1;i<=k;i++)
for(int j=1;j<=k;j++){
int x1=i-1,y1=1-i,x2=m+j-1,y2=n-j+1;
// cerr<<x1<<' '<<y1<<' '<<x2<<' '<<y2<<'\n';
A._m[i][j]=C(abs(x1-x2)+abs(y1-y2),abs(x1-x2));
}
printf("%lld",A.det());
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 5308kb
input:
1 1 1
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5312kb
input:
2 2 2
output:
20
result:
ok 1 number(s): "20"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 5300kb
input:
2 3 4
output:
999999272
result:
wrong answer 1st numbers differ - expected: '490', found: '999999272'