結果

問題 No.2154 あさかつの参加人数
ユーザー MichirakaraMichirakara
提出日時 2022-11-24 12:45:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,958 ms / 2,000 ms
コード長 632 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 33,764 KB
最終ジャッジ日時 2024-04-08 20:41:43
合計ジャッジ時間 38,735 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,932 ms
33,764 KB
testcase_01 AC 1,934 ms
33,764 KB
testcase_02 AC 1,946 ms
33,764 KB
testcase_03 AC 1,945 ms
33,764 KB
testcase_04 AC 1,958 ms
33,764 KB
testcase_05 AC 1,050 ms
10,496 KB
testcase_06 AC 1,553 ms
20,096 KB
testcase_07 AC 991 ms
25,292 KB
testcase_08 AC 938 ms
27,604 KB
testcase_09 AC 324 ms
22,528 KB
testcase_10 AC 880 ms
23,768 KB
testcase_11 AC 1,673 ms
31,196 KB
testcase_12 AC 1,307 ms
23,784 KB
testcase_13 AC 831 ms
15,360 KB
testcase_14 AC 1,442 ms
23,084 KB
testcase_15 AC 878 ms
26,692 KB
testcase_16 AC 1,385 ms
25,908 KB
testcase_17 AC 1,623 ms
22,912 KB
testcase_18 AC 1,676 ms
27,160 KB
testcase_19 AC 139 ms
12,672 KB
testcase_20 AC 1,346 ms
28,068 KB
testcase_21 AC 273 ms
21,120 KB
testcase_22 AC 544 ms
31,884 KB
testcase_23 AC 1,586 ms
27,752 KB
testcase_24 AC 1,751 ms
30,752 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