結果

問題 No.1000 Point Add and Array Add
ユーザー chinchilla
提出日時 2020-03-01 15:33:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 442 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 89,332 KB
最終ジャッジ日時 2024-10-13 20:42:34
合計ジャッジ時間 16,378 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 20 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
n = int(input().split()[0])
a = list(map(int, input().split()))
q = [s.split() for s in sys.stdin]
b = [0]*n
t = [0]*(1+n)
l = [0]*(n+1)
for c, x, y in reversed(q):
	x, y = int(x), int(y)
	if c>'A':
		for i, d in [(x, 1), (y+1, -1)]:
			l[i-1] += d
			while i<=n:
				t[i] += d
				i += i&-i
	else:
		s, i = 0, x
		while i:
			s += t[i]
			i -= i&-i
		b[x-1] += s * y
s = 0
for i in range(n):
	s += l[i]
	b[i] += s * a[i]
print(*b)
0