結果
| 問題 | No.3851 Dreams |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-12-04 21:52:22 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 948 ms / 2,000 ms |
| + 648µs | |
| コード長 | 1,543 bytes |
| 記録 | |
| コンパイル時間 | 80 ms |
| コンパイル使用メモリ | 64,552 KB |
| 実行使用メモリ | 61,052 KB |
| 最終ジャッジ日時 | 2026-12-04 21:52:36 |
| 合計ジャッジ時間 | 13,943 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge6_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
# Library: https://github.com/tyuyu-62/cp-library
from math import gcd, lcm, isqrt
from collections import deque, defaultdict
from itertools import permutations, product
from bisect import bisect_left, bisect_right
from heapq import heappush, heappop
from random import randint, shuffle
from time import perf_counter as pc
def II(): return int(input())
def LI(dec=0): return [int(x) - dec for x in input().split()]
def SI(): return input()
def LS(): return list(input().split())
mod = 998244353
inf = 2002002002002002002
import sys
sys.setrecursionlimit(10 ** 6)
input = lambda: sys.stdin.readline().rstrip()
_buf = []
def print(*args, sep=" "): _buf.append(sep.join(map(str, args)))
def debug(*args):
if DEBUG:
sys.stderr.write(" ".join(map(str, args)) + "\n")
sys.stderr.flush()
DEBUG = True
def solve():
N, M = LI()
li = []
inv = pow(100, -1, mod)
for i in range(N):
x, y, p, s = LI()
li.append((s, x, y, p * inv % mod))
li.sort(reverse = True)
T = LI()
ans = 0
for t in T:
q = 1
for s, x, y, p in li:
z = y // x
if t % x < y % x:
z += 1
z = min(z, t // x)
p = (1 - pow(1 - p, z, mod)) % mod
ans += q * p % mod * s % mod
ans %= mod
q = q * (1 - p) % mod
ans += q
ans %= mod
print(ans)
return
if __name__ == "__main__":
T = 1
# T = II()
for _ in range(T):
solve()
sys.stdout.write("\n".join(_buf) + "\n")