QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#113660 | #5661. Multi-Ladders | UFRJ# | WA | 1ms | 3528kb | C++20 | 784b | 2023-06-19 03:11:33 | 2023-06-19 03:11:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
using lint = int64_t;
const lint MOD = 1000000007;
lint mod(lint x){
x %= MOD;
x += MOD;
x %= MOD;
return x;
}
lint modpow(lint x, lint e){
lint r = 1;
for(; e; e >>= 1){
if(e & 1) r = mod(r * x);
x = mod(x * x);
}
return r;
}
void solve(){
lint n, k, l;
cin>>n>>k>>l;
lint cycle = modpow(-1,k) * modpow(l-1, k) + l - 1;
cycle = mod(modpow(-1, k) * cycle);
lint ladder = modpow( modpow((l-2) * (l-2) + l-1, n-1) , k );
lint answer = mod(ladder * cycle);
cout<<answer<<"\n";
}
int main(){
cin.tie(0)->sync_with_stdio(false);
int t; cin>>t;
while(t--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3448kb
input:
1 2 3 3
output:
162
result:
ok single line: '162'
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3528kb
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 122172385 0 0 0 349400141 536959608 52489881 53690844 994176158 218103365 148794338 991895211 693053429 883715672 80402569 0 0 122563013
result:
wrong answer 3rd lines differ - expected: '0', found: '122172385'