結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー 👑 timitimi
提出日時 2023-05-19 21:34:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 416 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 87,028 KB
実行使用メモリ 90,800 KB
最終ジャッジ日時 2023-08-22 23:38:54
合計ジャッジ時間 11,552 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,416 KB
testcase_01 AC 68 ms
71,412 KB
testcase_02 AC 85 ms
75,532 KB
testcase_03 AC 73 ms
71,380 KB
testcase_04 AC 93 ms
76,092 KB
testcase_05 AC 94 ms
76,376 KB
testcase_06 AC 96 ms
76,504 KB
testcase_07 AC 272 ms
87,092 KB
testcase_08 AC 136 ms
82,336 KB
testcase_09 AC 200 ms
87,132 KB
testcase_10 AC 205 ms
78,460 KB
testcase_11 AC 217 ms
83,508 KB
testcase_12 AC 250 ms
90,800 KB
testcase_13 AC 201 ms
88,912 KB
testcase_14 AC 190 ms
84,656 KB
testcase_15 AC 319 ms
83,656 KB
testcase_16 AC 329 ms
79,296 KB
testcase_17 AC 364 ms
90,580 KB
testcase_18 AC 365 ms
90,624 KB
testcase_19 AC 360 ms
90,368 KB
testcase_20 AC 362 ms
90,236 KB
testcase_21 AC 416 ms
90,324 KB
testcase_22 AC 364 ms
90,432 KB
testcase_23 AC 359 ms
90,340 KB
testcase_24 AC 364 ms
90,236 KB
testcase_25 AC 358 ms
90,480 KB
testcase_26 AC 361 ms
90,600 KB
testcase_27 AC 334 ms
90,036 KB
testcase_28 AC 360 ms
90,016 KB
testcase_29 AC 328 ms
78,472 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int, input().split())
A=list(map(int, input().split()))
now=0
for a in A:
  now+=a**2 
  
Q=int(input())
for _ in range(Q):
  c,k,d=map(int, input().split())
  c-=1;d-=1
  now-=A[c]**2+A[d]**2
  A[c]-=k;A[d]+=k
  now+=A[c]**2+A[d]**2
  print(now)
0