QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#454510 | #1259. Game On Board | Kevin5307 | AC ✓ | 0ms | 3708kb | C++23 | 979b | 2024-06-25 00:03:01 | 2024-06-25 00:03:01 |
Judging History
answer
//Author: Kevin
#include<bits/stdc++.h>
//#pragma GCC optimize("O2")
using namespace std;
#define ll long long
#define ull unsigned ll
#define pb emplace_back
#define mp make_pair
#define ALL(x) (x).begin(),(x).end()
#define rALL(x) (x).rbegin(),(x).rend()
#define srt(x) sort(ALL(x))
#define rev(x) reverse(ALL(x))
#define rsrt(x) sort(rALL(x))
#define sz(x) (int)(x.size())
#define inf 0x3f3f3f3f
#define pii pair<int,int>
#define lb(v,x) (int)(lower_bound(ALL(v),x)-v.begin())
#define ub(v,x) (int)(upper_bound(ALL(v),x)-v.begin())
#define uni(v) v.resize(unique(ALL(v))-v.begin())
#define longer __int128_t
void die(string S){puts(S.c_str());exit(0);}
const ll mod=998244353;
ll ksm(ll a,ll b)
{
ll ans=1;
while(b)
{
if(b&1) ans=ans*a%mod;
b>>=1;
a=a*a%mod;
}
return ans;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n,m;
cin>>n>>m;
cout<<ksm(n,m-1)*ksm(m,n-1)%mod<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3568kb
input:
1 1
output:
1
result:
ok answer is '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2 2
output:
4
result:
ok answer is '4'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
1 100000000
output:
1
result:
ok answer is '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1000000000 1
output:
1
result:
ok answer is '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
998244353 1
output:
1
result:
ok answer is '1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
2 998244353
output:
0
result:
ok answer is '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
998244353 1000000000
output:
0
result:
ok answer is '0'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3708kb
input:
1000000000 1000000000
output:
246032221
result:
ok answer is '246032221'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
654654 765433688
output:
931405037
result:
ok answer is '931405037'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1000000000 999999999
output:
204552645
result:
ok answer is '204552645'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
666666666 777777777
output:
487109550
result:
ok answer is '487109550'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
998244353 998244353
output:
0
result:
ok answer is '0'