結果

問題 No.2306 [Cherry 5th Tune C] ウソツキタマシイ
ユーザー とろちゃとろちゃ
提出日時 2023-05-19 21:37:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 986 bytes
コンパイル時間 905 ms
コンパイル使用メモリ 86,676 KB
実行使用メモリ 92,352 KB
最終ジャッジ日時 2023-08-22 23:40:28
合計ジャッジ時間 7,501 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,280 KB
testcase_01 AC 64 ms
71,360 KB
testcase_02 AC 75 ms
75,416 KB
testcase_03 AC 69 ms
71,244 KB
testcase_04 AC 76 ms
76,160 KB
testcase_05 AC 75 ms
75,956 KB
testcase_06 AC 75 ms
75,840 KB
testcase_07 AC 150 ms
88,172 KB
testcase_08 AC 98 ms
82,856 KB
testcase_09 AC 120 ms
88,388 KB
testcase_10 AC 119 ms
81,932 KB
testcase_11 AC 124 ms
84,636 KB
testcase_12 AC 141 ms
91,432 KB
testcase_13 AC 131 ms
89,636 KB
testcase_14 AC 119 ms
85,292 KB
testcase_15 AC 151 ms
87,672 KB
testcase_16 AC 155 ms
87,496 KB
testcase_17 AC 175 ms
91,912 KB
testcase_18 AC 173 ms
91,908 KB
testcase_19 AC 173 ms
91,996 KB
testcase_20 AC 170 ms
92,164 KB
testcase_21 AC 169 ms
91,928 KB
testcase_22 AC 174 ms
92,040 KB
testcase_23 AC 175 ms
91,932 KB
testcase_24 AC 174 ms
92,104 KB
testcase_25 AC 176 ms
91,948 KB
testcase_26 AC 174 ms
92,352 KB
testcase_27 AC 163 ms
91,184 KB
testcase_28 AC 166 ms
91,516 KB
testcase_29 AC 156 ms
87,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1")
# from bisect import *
# from collections import *
# from heapq import *
# from itertools import *
# from math import *
# from datetime import *
# from decimal import*
# from string import ascii_lowercase,ascii_uppercase
# import numpy as np
import sys
import os

# sys.setrecursionlimit(10**6)
INF = 10**18
MOD = 998244353
# MOD = 10**9 + 7
File = open("input.txt", "r") if os.path.exists("input.txt") else sys.stdin


def input():
    return File.readline()[:-1]


# ///////////////////////////////////////////////////////////////////////////


N, M = map(int, input().split())
A = [0] + list(map(int, input().split()))
Q = int(input())
query = [list(map(int, input().split())) for _ in range(Q)]
powerSum = sum([A[i] ** 2 for i in range(M + 1)])

for c, k, d in query:
    powerSum -= A[c] ** 2
    powerSum -= A[d] ** 2
    A[c] -= k
    A[d] += k
    powerSum += A[c] ** 2
    powerSum += A[d] ** 2
    print(powerSum)
0