Submission #20391448


Source Code Expand

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<bitset>
#include<deque>
#define mod  998244353
#include<cstdlib>
#include<set>
#include<ctime>
#define ll long long
#define mp make_pair
using namespace std;
ll read()
{
	ll x=0,f=1;
	char c=getchar();
	while(c>'9'||c<'0')
	{
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9')
	{
		x=x*10+c-'0';
		c=getchar();
	}
	return f*x;
}
ll pow_mod(ll a,int b)
{
	ll ans=1;
	while(b)
	{
		if(b&1) ans=ans*a%mod;
		b>>=1;
		a=a*a%mod; 
	}
	return ans;
}
int n,m,k;
ll ans;
int main()
{
	n=read(),m=read(),k=read();
	if(n==1||m==1)
	{
		if(n<m) swap(n,m);
		cout<<pow_mod(k,n)<<'\n';
		return 0;
	}
	for(int i=1;i<=k;++i)
	{
		ll tn=(pow_mod(i,n)-pow_mod(i-1,n)+mod)%mod;
		ll tm=pow_mod(k-i+1,m);
		ans=(ans+tn*tm%mod)%mod;
	}
	cout<<ans<<'\n';
	return 0;
 }

Submission Info

Submission Time
Task D - Sky Reflector
User MTS_zx
Language C++ (Clang 10.0.0)
Score 600
Code Size 968 Byte
Status AC
Exec Time 48 ms
Memory 3076 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 15
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 48 ms 2888 KiB
02.txt AC 20 ms 2860 KiB
03.txt AC 2 ms 2908 KiB
04.txt AC 2 ms 3064 KiB
05.txt AC 2 ms 2924 KiB
06.txt AC 3 ms 3044 KiB
07.txt AC 2 ms 2976 KiB
08.txt AC 2 ms 2968 KiB
09.txt AC 8 ms 2936 KiB
10.txt AC 17 ms 2884 KiB
11.txt AC 5 ms 3076 KiB
12.txt AC 2 ms 2892 KiB
s1.txt AC 3 ms 3060 KiB
s2.txt AC 2 ms 2916 KiB
s3.txt AC 16 ms 3072 KiB