結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー 👑 timitimi
提出日時 2023-05-19 21:34:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 342 ms / 2,000 ms
コード長 254 bytes
コンパイル時間 833 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 89,600 KB
最終ジャッジ日時 2024-05-10 05:15:23
合計ジャッジ時間 10,038 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
51,840 KB
testcase_01 AC 37 ms
51,712 KB
testcase_02 AC 56 ms
61,440 KB
testcase_03 AC 42 ms
52,992 KB
testcase_04 AC 65 ms
65,792 KB
testcase_05 AC 69 ms
66,304 KB
testcase_06 AC 69 ms
66,432 KB
testcase_07 AC 258 ms
86,272 KB
testcase_08 AC 115 ms
81,024 KB
testcase_09 AC 175 ms
86,272 KB
testcase_10 AC 181 ms
76,800 KB
testcase_11 AC 188 ms
82,560 KB
testcase_12 AC 223 ms
89,088 KB
testcase_13 AC 176 ms
87,296 KB
testcase_14 AC 164 ms
83,200 KB
testcase_15 AC 287 ms
82,560 KB
testcase_16 AC 283 ms
78,336 KB
testcase_17 AC 330 ms
88,960 KB
testcase_18 AC 313 ms
89,216 KB
testcase_19 AC 329 ms
89,472 KB
testcase_20 AC 342 ms
89,216 KB
testcase_21 AC 321 ms
88,960 KB
testcase_22 AC 332 ms
89,600 KB
testcase_23 AC 322 ms
88,960 KB
testcase_24 AC 318 ms
89,472 KB
testcase_25 AC 309 ms
88,960 KB
testcase_26 AC 300 ms
89,472 KB
testcase_27 AC 291 ms
88,832 KB
testcase_28 AC 312 ms
88,960 KB
testcase_29 AC 299 ms
76,160 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