結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー sepa38sepa38
提出日時 2023-05-19 21:27:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 352 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 86,780 KB
実行使用メモリ 90,428 KB
最終ジャッジ日時 2023-08-22 23:32:36
合計ジャッジ時間 9,868 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,084 KB
testcase_01 AC 63 ms
71,120 KB
testcase_02 AC 80 ms
75,576 KB
testcase_03 AC 68 ms
71,284 KB
testcase_04 AC 90 ms
76,048 KB
testcase_05 AC 87 ms
76,008 KB
testcase_06 AC 87 ms
76,016 KB
testcase_07 AC 246 ms
86,660 KB
testcase_08 AC 127 ms
81,940 KB
testcase_09 AC 191 ms
86,976 KB
testcase_10 AC 192 ms
78,180 KB
testcase_11 AC 203 ms
83,224 KB
testcase_12 AC 235 ms
90,156 KB
testcase_13 AC 187 ms
88,256 KB
testcase_14 AC 180 ms
84,568 KB
testcase_15 AC 288 ms
83,692 KB
testcase_16 AC 294 ms
78,852 KB
testcase_17 AC 342 ms
90,240 KB
testcase_18 AC 352 ms
89,924 KB
testcase_19 AC 342 ms
90,428 KB
testcase_20 AC 337 ms
90,160 KB
testcase_21 AC 328 ms
90,068 KB
testcase_22 AC 334 ms
90,428 KB
testcase_23 AC 334 ms
89,900 KB
testcase_24 AC 337 ms
90,176 KB
testcase_25 AC 332 ms
90,428 KB
testcase_26 AC 323 ms
90,060 KB
testcase_27 AC 314 ms
89,248 KB
testcase_28 AC 315 ms
89,004 KB
testcase_29 AC 296 ms
77,924 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