結果

問題 No.2154 あさかつの参加人数
ユーザー MichirakaraMichirakara
提出日時 2022-11-08 23:45:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 426 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 84,164 KB
最終ジャッジ日時 2024-04-08 20:39:45
合計ジャッジ時間 12,652 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 426 ms
84,164 KB
testcase_01 AC 425 ms
84,164 KB
testcase_02 AC 420 ms
84,164 KB
testcase_03 AC 425 ms
84,164 KB
testcase_04 AC 425 ms
84,164 KB
testcase_05 AC 232 ms
76,396 KB
testcase_06 AC 369 ms
79,708 KB
testcase_07 AC 247 ms
81,208 KB
testcase_08 AC 233 ms
81,976 KB
testcase_09 AC 111 ms
80,244 KB
testcase_10 AC 227 ms
80,700 KB
testcase_11 AC 380 ms
83,264 KB
testcase_12 AC 327 ms
80,972 KB
testcase_13 AC 224 ms
77,756 KB
testcase_14 AC 351 ms
80,456 KB
testcase_15 AC 220 ms
81,832 KB
testcase_16 AC 327 ms
81,392 KB
testcase_17 AC 405 ms
80,424 KB
testcase_18 AC 384 ms
81,916 KB
testcase_19 AC 95 ms
76,944 KB
testcase_20 AC 314 ms
82,184 KB
testcase_21 AC 104 ms
79,908 KB
testcase_22 AC 134 ms
83,564 KB
testcase_23 AC 356 ms
81,996 KB
testcase_24 AC 393 ms
83,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#リストを入れるよ
#fold(r)でtable[0,r)の累積和
#fold_(l,r)でtable[l,r)の累積和
class CumulativeSum:
  def __init__(self,table):
    self.table=table.copy()
    for i in range(1,len(self.table)):
      self.table[i]+=self.table[i-1]
  
  def fold(self,r:int):
    if r<=0:
      return 0
    return self.table[r-1]
  
  def fold_(self,l:int,r:int):
    if l==0:
      return self.fold(r)
    return self.fold(r)-self.fold(l)
d,n=map(int,input().split())
imos=[0]*(d+1)
for i in range(n):
  r,l=map(int,input().split())
  imos[l-1]+=1
  imos[r]-=1
c=CumulativeSum(imos)
for i in range(d-1,-1,-1):
  print(c.table[i])
0