結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー sepa38sepa38
提出日時 2023-05-19 21:27:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 328 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 89,856 KB
最終ジャッジ日時 2024-05-10 05:10:03
合計ジャッジ時間 8,989 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,968 KB
testcase_01 AC 35 ms
51,328 KB
testcase_02 AC 56 ms
62,592 KB
testcase_03 AC 40 ms
52,864 KB
testcase_04 AC 64 ms
66,432 KB
testcase_05 AC 64 ms
67,328 KB
testcase_06 AC 66 ms
68,224 KB
testcase_07 AC 230 ms
85,760 KB
testcase_08 AC 110 ms
81,112 KB
testcase_09 AC 165 ms
86,016 KB
testcase_10 AC 176 ms
77,184 KB
testcase_11 AC 185 ms
82,120 KB
testcase_12 AC 214 ms
89,472 KB
testcase_13 AC 169 ms
87,040 KB
testcase_14 AC 157 ms
82,944 KB
testcase_15 AC 275 ms
82,388 KB
testcase_16 AC 296 ms
78,080 KB
testcase_17 AC 325 ms
89,344 KB
testcase_18 AC 316 ms
89,600 KB
testcase_19 AC 318 ms
89,216 KB
testcase_20 AC 315 ms
89,600 KB
testcase_21 AC 315 ms
89,728 KB
testcase_22 AC 312 ms
89,472 KB
testcase_23 AC 328 ms
89,600 KB
testcase_24 AC 309 ms
89,472 KB
testcase_25 AC 315 ms
89,728 KB
testcase_26 AC 327 ms
89,856 KB
testcase_27 AC 293 ms
88,192 KB
testcase_28 AC 316 ms
88,576 KB
testcase_29 AC 298 ms
77,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
for v in a:
  ans += v ** 2
for _ in range(int(input())):
  c, k, d = map(lambda x: int(x)-1, input().split())
  k += 1
  ans -= a[c] ** 2
  a[c] -= k
  ans += a[c] ** 2
  ans -= a[d] ** 2
  a[d] += k
  ans += a[d] ** 2
  print(ans)
0