General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
160447863 Practice:
plevande
1065E - 8 PyPy 3 Accepted 217 ms 16436 KB 2022-06-13 19:30:18 2022-06-13 19:30:18
→ Source
import sys
input = sys.stdin.buffer.readline 

p = 998244353 

twoi = pow(2, p-2, p)
def process(n, B, k):
    m = len(B)
    answer = pow(k, n-2*B[-1], p)
    for i in range(m):
        if i==0:
            R = B[i]
        else:
            R = B[i]-B[i-1]
        entry = pow(k, 2*R, p)+pow(k, R, p)
        entry = (entry*twoi) % p
        answer = (answer*entry) % p
    print(answer)

n, m, k = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
process(n, B, k)
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details