結果

問題 No.2359 A in S ?
ユーザー とりゐとりゐ
提出日時 2023-01-16 11:39:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,378 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 174,864 KB
最終ジャッジ日時 2023-08-29 05:25:51
合計ジャッジ時間 8,658 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
100,804 KB
testcase_01 AC 145 ms
100,692 KB
testcase_02 AC 151 ms
100,776 KB
testcase_03 AC 134 ms
100,624 KB
testcase_04 AC 278 ms
117,860 KB
testcase_05 AC 461 ms
150,472 KB
testcase_06 AC 272 ms
117,940 KB
testcase_07 AC 241 ms
119,664 KB
testcase_08 AC 1,378 ms
152,932 KB
testcase_09 AC 256 ms
119,936 KB
testcase_10 AC 403 ms
172,964 KB
testcase_11 AC 413 ms
174,864 KB
testcase_12 AC 272 ms
118,200 KB
testcase_13 AC 262 ms
117,748 KB
testcase_14 AC 266 ms
118,080 KB
testcase_15 AC 254 ms
118,208 KB
testcase_16 AC 270 ms
118,000 KB
testcase_17 AC 260 ms
118,176 KB
testcase_18 AC 260 ms
117,876 KB
testcase_19 AC 261 ms
118,132 KB
権限があれば一括ダウンロードができます

ソースコード

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