結果
問題 | No.1000 Point Add and Array Add |
ユーザー | mkawa2 |
提出日時 | 2020-02-28 22:05:22 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 1,712 ms / 2,000 ms |
コード長 | 1,187 bytes |
コンパイル時間 | 172 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 83,300 KB |
最終ジャッジ日時 | 2024-04-21 18:33:01 |
合計ジャッジ時間 | 13,865 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 25 ms
10,880 KB |
testcase_01 | AC | 25 ms
10,880 KB |
testcase_02 | AC | 26 ms
10,880 KB |
testcase_03 | AC | 26 ms
10,880 KB |
testcase_04 | AC | 27 ms
10,880 KB |
testcase_05 | AC | 30 ms
10,752 KB |
testcase_06 | AC | 28 ms
10,752 KB |
testcase_07 | AC | 29 ms
10,880 KB |
testcase_08 | AC | 29 ms
10,752 KB |
testcase_09 | AC | 25 ms
10,880 KB |
testcase_10 | AC | 25 ms
10,752 KB |
testcase_11 | AC | 26 ms
10,880 KB |
testcase_12 | AC | 36 ms
11,264 KB |
testcase_13 | AC | 34 ms
11,136 KB |
testcase_14 | AC | 41 ms
11,520 KB |
testcase_15 | AC | 35 ms
11,264 KB |
testcase_16 | AC | 1,134 ms
62,184 KB |
testcase_17 | AC | 1,015 ms
57,072 KB |
testcase_18 | AC | 1,645 ms
82,476 KB |
testcase_19 | AC | 1,620 ms
82,400 KB |
testcase_20 | AC | 1,198 ms
71,004 KB |
testcase_21 | AC | 1,693 ms
80,732 KB |
testcase_22 | AC | 1,425 ms
83,300 KB |
testcase_23 | AC | 1,712 ms
80,860 KB |
ソースコード
import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def MI(): return map(int, sys.stdin.readline().split()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def SI(): return sys.stdin.readline()[:-1] class BitSum: def __init__(self, n): self.n = n + 3 self.table = [0] * (self.n + 1) def add(self, i, x): i += 1 while i <= self.n: self.table[i] += x i += i & -i def sum(self, i): i += 1 res = 0 while i > 0: res += self.table[i] i -= i & -i return res def main(): n,q=MI() aa=LI() cxy=[input().split() for _ in range(q)] bit=BitSum(n+1) bb=[0]*n for c,x,y in cxy[::-1]: x,y=int(x),int(y) if c=="A": x-=1 k=bit.sum(x) bb[x]+=k*y else: x,y=x-1,y-1 bit.add(x,1) bit.add(y+1,-1) for i in range(n): k=bit.sum(i) bb[i]+=k*aa[i] print(*bb) main()