結果

問題 No.2154 あさかつの参加人数
ユーザー MichirakaraMichirakara
提出日時 2022-11-08 12:16:14
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 624 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 84,164 KB
最終ジャッジ日時 2024-04-08 20:40:08
合計ジャッジ時間 10,346 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

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):
  l,r=map(int,input().split())
  imos[l-1]+=1
  imos[r]-=1
c=CumulativeSum(imos)
for i in range(d):
  print(c.table[i])
0