QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#281183 | #1259. Game On Board | KLPP# | AC ✓ | 0ms | 3724kb | C++14 | 643b | 2023-12-09 22:56:11 | 2023-12-09 22:56:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for (int i = a; i < b; i++)
#define trav(a,b) for (auto a : b)
#define lld long long
using i64 = long long;
#define all(x) begin(x),end(x)
const lld MOD=998244353;
lld ModPow(lld base, lld exp){
if(exp==0)return 1;
if(exp%2==1)return (base*ModPow(base,exp-1))%MOD;
lld a=ModPow(base,exp/2);
return (a*a)%MOD;
}
void solve() {
lld n,m;
cin>>n>>m;
lld ans=ModPow(n,m-1)*ModPow(m,n-1);
ans%=MOD;
cout<<ans<<"\n";
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int tt = 1;
//~ cin >> tt;
while (tt--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3724kb
input:
1 1
output:
1
result:
ok answer is '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
2 2
output:
4
result:
ok answer is '4'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
1 100000000
output:
1
result:
ok answer is '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
1000000000 1
output:
1
result:
ok answer is '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
998244353 1
output:
1
result:
ok answer is '1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
2 998244353
output:
0
result:
ok answer is '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
998244353 1000000000
output:
0
result:
ok answer is '0'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3652kb
input:
1000000000 1000000000
output:
246032221
result:
ok answer is '246032221'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
654654 765433688
output:
931405037
result:
ok answer is '931405037'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
1000000000 999999999
output:
204552645
result:
ok answer is '204552645'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
666666666 777777777
output:
487109550
result:
ok answer is '487109550'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
998244353 998244353
output:
0
result:
ok answer is '0'