General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
208878795 Practice:
okay4869
1065E - 8 PyPy 3-64 Accepted 467 ms 26880 KB 2023-06-07 12:56:09 2023-06-07 12:56:13
→ Source
n,m,a=map(int,input().split())
b=[0]+list(map(int,input().split()))
mod=998244353
ans = pow(a, n - 2 * b[-1], mod)
for i in range(1, m+1):
    diff = b[i] - b[i - 1]
    ans = ans * ((pow(a, 2 * diff, mod) + pow(a, diff, mod)) % mod * ((mod + 1) // 2) % mod) % mod
print(ans)
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details