QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#89292#5661. Multi-Ladderskatoli#WA 2ms3416kbC++14748b2023-03-19 16:09:172023-03-19 16:09:18

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-19 16:09:18]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3416kb
  • [2023-03-19 16:09:17]
  • 提交

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'