結果

問題 No.1000 Point Add and Array Add
ユーザー ryo_nryo_n
提出日時 2020-02-28 22:09:43
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 892 bytes
コンパイル時間 338 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 112,700 KB
最終ジャッジ日時 2024-04-21 19:02:23
合計ジャッジ時間 5,716 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
60,276 KB
testcase_01 AC 47 ms
52,096 KB
testcase_02 AC 42 ms
51,968 KB
testcase_03 AC 38 ms
52,224 KB
testcase_04 AC 38 ms
52,204 KB
testcase_05 AC 39 ms
52,224 KB
testcase_06 AC 39 ms
52,224 KB
testcase_07 AC 39 ms
51,968 KB
testcase_08 AC 39 ms
51,968 KB
testcase_09 AC 38 ms
52,352 KB
testcase_10 AC 39 ms
52,224 KB
testcase_11 AC 39 ms
52,736 KB
testcase_12 AC 149 ms
76,836 KB
testcase_13 AC 143 ms
76,544 KB
testcase_14 AC 218 ms
77,064 KB
testcase_15 AC 106 ms
77,068 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)

    Atmp = []

    for c, x, y in CXY:
        if c == 'A':
            Atmp.append([int(x), int(y)])
            Atmp.sort()
        else:
            for a, b in Atmp:
                if a < int(x):
                    continue
                elif a > int(y):
                    break
                else:
                    B[a - 1] += b
            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