結果
問題 | No.155 生放送とBGM |
ユーザー |
![]() |
提出日時 | 2020-04-19 01:09:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,019 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 51,040 KB |
最終ジャッジ日時 | 2024-10-04 00:38:28 |
合計ジャッジ時間 | 9,987 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 14 |
ソースコード
import sysread = sys.stdin.buffer.readreadline = sys.stdin.buffer.readlinereadlines = sys.stdin.buffer.readlinesimport numpy as npN, L = map(int, readline().split())L *= 60comb = np.zeros((60, 60), np.int64)comb[0, 0] = 1for n in range(1, 60):comb[n] += comb[n - 1]comb[n, 1:] += comb[n - 1, :-1]def convert(s):minute, second = map(int, s.split(b':'))return 60 * minute + secondS = tuple(map(convert, read().split()))full = sum(S)if L >= full:print(N)exit()dp = np.zeros((N + 1, L + 1), np.int64)dp[0, 0] = 1def add(dp, x):if x > L:returnfor n in range(N, 0, -1):dp[n, x:] += dp[n - 1, :-x]def remove(dp, x):if x > L:returnfor n in range(1, N + 1):dp[n, x:] -= dp[n - 1, :-x]for x in S:add(dp, x)expected = 0for x in S:remove(dp, x)p = 0for n in range(N):p += dp[n, :L].sum() / comb[N - 1, n]print(p)p /= Nexpected += padd(dp, x)print(expected)