結果
| 問題 |
No.2966 Simple Plus Minus Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-16 16:42:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,163 bytes |
| コンパイル時間 | 549 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 252,392 KB |
| 最終ジャッジ日時 | 2024-11-16 16:43:04 |
| 合計ジャッジ時間 | 17,012 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 48 |
ソースコード
n,k = map(int,input().split())
a = list(map(int,input().split()))
aa = a[:]
c = [a[:]]
import itertools
for i in range(10):
b = [a[j] if j % 2 == 0 else -a[j] for j in range(n)]
a = list(itertools.accumulate(b))
c.append(a)
#print(*a)
a = aa[:]
mod = 998244353
ans = []
for i in range(n):
if 0:
x = c[1][i] - c[0][i]
y = c[3][i] - c[2][i]
cnt = (k//2) + (k % 2)
d = y-x
res = x * cnt + d * ((1+cnt-1)*(cnt-1)//2)
x = c[2][i] - c[1][i]
y = c[4][i] - c[3][i]
cnt = (k//2)
d = abs(y-x)
print(i,x,y,d,cnt)
res += (x * cnt + d * ((1+cnt-1)*(cnt-1)//2) + a[i]) % mod
ans.append(res%mod)
else:
x = c[1][i] - c[0][i]
y = c[3][i] - c[2][i]
cnt = (k//2) + (k % 2)
d = -abs(y-x)
res = x * cnt + d * ((1+cnt-1)*(cnt-1)//2)
x = c[2][i] - c[1][i]
y = c[4][i] - c[3][i]
cnt = (k//2)
d = abs(y-x)
res += (x * cnt + d * ((1+cnt-1)*(cnt-1)//2) + a[i]) % mod
ans.append(res%mod)
print(*ans)
-20
20
-20
20
-6
8
-9
11
-12
14
-2
6
-3
8
-4
10
-5
12
-6