QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#89292 | #5661. Multi-Ladders | katoli# | WA | 2ms | 3416kb | C++14 | 748b | 2023-03-19 16:09:17 | 2023-03-19 16:09:18 |
Judging History
answer
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
using ll=long long;
const int MOD=1e9+7;
ll qpow(ll x,ll y){
ll res=1;
for(;y;y>>=1){
if(y&1)res*=x,res%=MOD;
x*=x;
x%=MOD;
}
return res;
}
int cal(){
ll n,k,l;cin>>n>>k>>l;
ll ans=qpow(l*l-3*l+3,k*(n-1));
if(k==3){
ans*=l;ans%=MOD;
ans*=(l-1);ans%=MOD;
ans*=(l-2);ans%=MOD;
}else{
ans*=(l*qpow(l-1,k-3)%MOD*(l-2)%MOD+l*qpow(l-1,k-2)%MOD*(l-2)%MOD)%MOD;
ans%=MOD;
}
return ans;
}
signed main() {
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int T;cin>>T;
while(T--){
cout<<cal()<<endl;
}
return 0;
}
// init?
// var->0?
// infinite dfs?
// out of bound?
// max_element / min_element?
詳細信息
Test #1:
score: 100
Accepted
time: 2ms
memory: 3376kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3416kb
input:
20 2 3 3 1 3 3 10 3 0 10 3 2 1 21 2 1 22 0 2000 15000 2000 12000 30000 200000 1000000000 3 3 2 1000000000 3 2 3 100000000 1000000000 1000000000 10 1000000000 3 100000000 2 1000000000 100000000 1 1000000000 10 1 1000000000 100000000 1 1000 100000000 1000000000 1000000000 0 1000000000 1000000000 1 100...
output:
162 6 0 0 0 0 888263007 844830037 52489881 779538007 543241858 224762221 993022479 181502871 963570284 882527144 946279795 0 0 59402164
result:
wrong answer 7th lines differ - expected: '349400141', found: '888263007'