結果

問題 No.1000 Point Add and Array Add
ユーザー ryo_nryo_n
提出日時 2020-02-28 23:34:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 737 bytes
コンパイル時間 334 ms
コンパイル使用メモリ 81,840 KB
実行使用メモリ 111,172 KB
最終ジャッジ日時 2024-04-21 20:56:57
合計ジャッジ時間 5,597 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
58,240 KB
testcase_01 AC 35 ms
52,352 KB
testcase_02 AC 35 ms
52,352 KB
testcase_03 AC 35 ms
51,968 KB
testcase_04 AC 34 ms
52,224 KB
testcase_05 AC 35 ms
52,248 KB
testcase_06 AC 34 ms
51,968 KB
testcase_07 AC 36 ms
51,968 KB
testcase_08 AC 35 ms
52,352 KB
testcase_09 AC 35 ms
52,480 KB
testcase_10 AC 34 ms
51,968 KB
testcase_11 AC 33 ms
52,352 KB
testcase_12 AC 53 ms
67,152 KB
testcase_13 AC 55 ms
66,688 KB
testcase_14 AC 70 ms
72,448 KB
testcase_15 AC 66 ms
70,912 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import itertools

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, Q = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]
    B = [0] * N
    
    CXY = [[x for x in input().split()] for _ in range(Q)]

    C = [0] * (N + 1)


    for c, x, y in CXY[::-1]:
        if c == 'A':
            ac = 0
            for i in range(int(x)):
                ac += C[i]
            B[int(x) - 1] += ac * int(y)

        else:
            C[int(x) - 1] += 1
            C[int(y)] -= 1

    C_acc = list(itertools.accumulate(C))

    for i, c in enumerate(C_acc):
        if i == N:
            break
        B[i] += A[i] * c

    print(*B)


if __name__ == '__main__':
    main()

0