General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
61393368 Practice:
Retired_xryjr233
1065E - 8 GNU C++11 Accepted 93 ms 788 KB 2019-09-28 02:47:50 2019-09-28 02:47:50
→ Source
#include<bits/stdc++.h>
using namespace std;
int mod=998244353;
int n,m,a,b[200010],t,lst,ans;
int POW(int x,int y){
	int tot=1;
	while(y)y&1?tot=1ll*tot*x%mod:0,x=1ll*x*x%mod,y>>=1;
	return tot;
}
int main(){
	scanf("%d%d%d",&n,&m,&a);
	for(int i=1;i<=m;++i,lst=t)scanf("%d",&t),b[i]=t-lst;
	ans=POW(a,n-lst);
	for(int i=1;i<=m;++i)ans=1ll*ans*(1+POW(a,b[i]))%mod;
	printf("%I64d",1ll*ans*POW(POW(2,m),mod-2)%mod);
	return 0;
}
//QWQ
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details