結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー 倉
提出日時 2023-05-19 21:36:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 236 ms / 2,000 ms
コード長 744 bytes
コンパイル時間 550 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 108,112 KB
最終ジャッジ日時 2023-08-22 23:40:19
合計ジャッジ時間 8,941 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
72,512 KB
testcase_01 AC 103 ms
72,676 KB
testcase_02 AC 113 ms
77,092 KB
testcase_03 AC 106 ms
72,552 KB
testcase_04 AC 118 ms
77,200 KB
testcase_05 AC 116 ms
77,468 KB
testcase_06 AC 118 ms
77,460 KB
testcase_07 AC 192 ms
95,044 KB
testcase_08 AC 141 ms
83,360 KB
testcase_09 AC 164 ms
88,632 KB
testcase_10 AC 167 ms
90,052 KB
testcase_11 AC 174 ms
90,468 KB
testcase_12 AC 188 ms
93,884 KB
testcase_13 AC 166 ms
90,080 KB
testcase_14 AC 158 ms
86,144 KB
testcase_15 AC 212 ms
98,616 KB
testcase_16 AC 218 ms
105,252 KB
testcase_17 AC 234 ms
107,916 KB
testcase_18 AC 231 ms
107,756 KB
testcase_19 AC 232 ms
108,112 KB
testcase_20 AC 234 ms
107,760 KB
testcase_21 AC 233 ms
107,600 KB
testcase_22 AC 231 ms
107,632 KB
testcase_23 AC 229 ms
107,480 KB
testcase_24 AC 236 ms
107,724 KB
testcase_25 AC 231 ms
107,856 KB
testcase_26 AC 233 ms
107,708 KB
testcase_27 AC 217 ms
104,452 KB
testcase_28 AC 225 ms
104,348 KB
testcase_29 AC 219 ms
105,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from functools import partial
# import pypyjit
# pypyjit.set_param('max_unroll_recursion = -1')

sys.setrecursionlimit(500005)
stdin = sys.stdin

ns = lambda: stdin.readline().strip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nz = lambda: list(map(lambda x: int(x)-1, stdin.readline().split())) # 遅い
printa = partial(print, sep="\n") # printa(*A) で各要素を改行して出力
mod = 1000000007 # 998244353
inf = 10 ** 18

N, M = na()
A = na()
Q = ni()
L = []
for _ in range(Q):
    L.append(na())

ans = 0
for i in range(M):
    ans += A[i] ** 2

ret = []
for l in L:
    c, k, d = l
    ans += 2 * k * (A[d-1] - A[c-1] + k)
    ret.append(ans)
    A[d-1] += k
    A[c-1] -= k

printa(*ret)
0