General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
44182309 Practice:
libra9z
1065E - 6 GNU C11 Accepted 77 ms 792 KB 2018-10-12 14:49:58 2018-10-12 14:49:58
→ Source
#include <stdio.h>
#define mod 998244353
int n,m,k,z,i,ans=1,a[200005];
int fastpow(int x,int y)
{
	int v=1;
	while (y)
	{
		if (y&1) v=1LL*v*x%mod;
		x=1LL*x*x%mod;
		y>>=1;
	}
	return v;
}
int main()
{
	register int i;
	scanf("%d%d%d",&n,&m,&k);
	for (i=1;i<=m;i++)
	{
		scanf("%d",a+i);
		z=fastpow(k,a[i]-a[i-1]);
		ans=(1LL*z*(z+1)/2%mod*ans)%mod;
	}
	printf("%I64d\n",1LL*ans*fastpow(k,n-a[m]*2)%mod);
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details