結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー ShirotsumeShirotsume
提出日時 2023-05-19 21:22:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 468 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 93,300 KB
最終ジャッジ日時 2023-08-22 23:24:32
合計ジャッジ時間 6,857 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,688 KB
testcase_01 AC 84 ms
71,788 KB
testcase_02 AC 92 ms
72,296 KB
testcase_03 AC 84 ms
71,444 KB
testcase_04 AC 98 ms
76,292 KB
testcase_05 AC 97 ms
76,276 KB
testcase_06 AC 97 ms
76,240 KB
testcase_07 AC 149 ms
88,000 KB
testcase_08 AC 118 ms
82,244 KB
testcase_09 AC 134 ms
88,280 KB
testcase_10 AC 124 ms
78,364 KB
testcase_11 AC 137 ms
84,332 KB
testcase_12 AC 149 ms
91,572 KB
testcase_13 AC 136 ms
89,760 KB
testcase_14 AC 131 ms
85,516 KB
testcase_15 AC 157 ms
86,028 KB
testcase_16 AC 151 ms
80,368 KB
testcase_17 AC 169 ms
91,708 KB
testcase_18 AC 170 ms
91,444 KB
testcase_19 AC 171 ms
91,584 KB
testcase_20 AC 174 ms
91,616 KB
testcase_21 AC 173 ms
91,584 KB
testcase_22 AC 171 ms
91,640 KB
testcase_23 AC 172 ms
91,600 KB
testcase_24 AC 172 ms
91,612 KB
testcase_25 AC 173 ms
91,304 KB
testcase_26 AC 173 ms
91,564 KB
testcase_27 AC 170 ms
93,220 KB
testcase_28 AC 172 ms
93,300 KB
testcase_29 AC 149 ms
77,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque, Counter
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 998244353

n, m = mi()

a = li()

ans = 0

for v in a:
    ans += v * v

for _ in range(ii()):
    c, k, d = mi()
    c -= 1; d -= 1
    ans -= a[c] ** 2
    ans -= a[d] ** 2
    a[c] -= k
    a[d] += k
    ans += a[c] ** 2
    ans += a[d] ** 2
    print(ans)
0