結果
問題 | No.1099 Range Square Sum |
ユーザー | 👑 Kazun |
提出日時 | 2020-06-26 21:52:05 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 766 bytes |
コンパイル時間 | 442 ms |
コンパイル使用メモリ | 87,236 KB |
実行使用メモリ | 265,588 KB |
最終ジャッジ日時 | 2023-09-18 04:13:21 |
合計ジャッジ時間 | 6,754 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,548 KB |
testcase_01 | AC | 71 ms
71,276 KB |
testcase_02 | AC | 71 ms
71,140 KB |
testcase_03 | AC | 72 ms
71,236 KB |
testcase_04 | AC | 69 ms
71,276 KB |
testcase_05 | AC | 71 ms
71,540 KB |
testcase_06 | AC | 71 ms
71,408 KB |
testcase_07 | AC | 72 ms
71,140 KB |
testcase_08 | AC | 72 ms
71,640 KB |
testcase_09 | AC | 70 ms
71,252 KB |
testcase_10 | AC | 72 ms
71,264 KB |
testcase_11 | AC | 113 ms
77,920 KB |
testcase_12 | AC | 113 ms
77,856 KB |
testcase_13 | AC | 116 ms
77,732 KB |
testcase_14 | AC | 116 ms
78,084 KB |
testcase_15 | AC | 114 ms
77,500 KB |
testcase_16 | AC | 109 ms
77,624 KB |
testcase_17 | AC | 105 ms
77,604 KB |
testcase_18 | AC | 115 ms
77,856 KB |
testcase_19 | AC | 115 ms
77,944 KB |
testcase_20 | AC | 117 ms
77,748 KB |
testcase_21 | TLE | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
ソースコード
class Imos_1: def __init__(self,N): self.len=N self.list=[0]*(N+1) def Add(self,F,T,C): self.list[F]+=C self.list[T+1]-=C def Cumulative_Sum(self): Y=[0]*(self.len) S=0 for i in range(self.len): S+=self.list[i] Y[i]=S return Y #---------------------------------------------------------- N=int(input()) A=list(map(int,input().split())) Q=int(input()) S=Imos_1(N) for i in range(Q): K=list(map(int,input().split())) if K[0]==1: _,l,r,x=K S.Add(l-1,r-1,x) else: _,l,r=K T=0 Y=S.Cumulative_Sum() for i in range(l-1,r): p=A[i] q=Y[i] T+=(p+q)*(p+q) print(T)