結果

問題 No.1000 Point Add and Array Add
ユーザー chinchillachinchilla
提出日時 2020-03-01 15:33:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 442 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 86,268 KB
最終ジャッジ日時 2024-04-21 22:17:35
合計ジャッジ時間 16,501 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,624 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 31 ms
10,624 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 30 ms
10,624 KB
testcase_09 AC 30 ms
10,624 KB
testcase_10 AC 30 ms
10,624 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 41 ms
11,392 KB
testcase_13 AC 39 ms
11,136 KB
testcase_14 AC 48 ms
11,520 KB
testcase_15 AC 40 ms
11,264 KB
testcase_16 AC 1,262 ms
64,280 KB
testcase_17 AC 1,266 ms
57,744 KB
testcase_18 AC 1,928 ms
85,116 KB
testcase_19 AC 1,919 ms
85,368 KB
testcase_20 AC 1,354 ms
73,420 KB
testcase_21 TLE -
testcase_22 AC 1,535 ms
86,268 KB
testcase_23 TLE -
権限があれば一括ダウンロードができます

ソースコード

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