General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
132980420 Practice:
resilient_phoenix
1065E - 8 C++14 (GCC 6-32) Accepted 389 ms 2608 KB 2021-10-25 08:31:09 2021-10-25 08:31:09
→ Source
#include<bits/stdc++.h>
using namespace std;
#define mod 998244353
#define maxn 200005
#define ll long long 
ll n,m,A,b[maxn];

ll Pow(ll a,ll b){
	ll res=1;
	while(b){
		if(b%2)res=a*res%mod;
		b>>=1;a=a*a%mod;
	}
	return res;
}

int main(){
	cin>>n>>m>>A;
	for(int i=1;i<=m;i++)cin>>b[i];
	sort(b+1,b+1+m);

	ll ans=Pow(A,n-2*b[m]);
	for(int i=1;i<=m;i++){
		ll p=Pow(A,b[i]-b[i-1]);
		ans=ans*((p*(p+1)/2)%mod)%mod;
	}
	cout<<ans<<endl;
} 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details