結果

問題 No.2359 A in S ?
ユーザー とりゐ
提出日時 2023-01-16 11:39:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,713 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 173,312 KB
最終ジャッジ日時 2024-12-30 21:30:40
合計ジャッジ時間 9,334 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m=map(int,input().split())
from collections import defaultdict
M=10**5+10
d=[defaultdict(lambda:defaultdict(int)) for i in range(M)]
for _ in range(n):
  l,r,x,y=map(int,input().split())
  l=(l-y+x-1)//x*x+y
  r=(r-y)//x*x+y
  if l>r:
    continue
  d[x][y][l]+=1
  d[x][y][r+x]-=1

ans=[0]*M
for x in range(M):
  for y in d[x]:
    res=0
    now=y
    while now<M:
      if now in d[x][y]:
        res+=d[x][y][now]
      ans[now]+=res
      now+=x

a=list(map(int,input().split()))
for i in a:
  print(ans[i])
0