結果
問題 |
No.398 ハーフパイプ(2)
|
ユーザー |
![]() |
提出日時 | 2023-11-02 12:49:25 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,400 bytes |
コンパイル時間 | 342 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 57,796 KB |
最終ジャッジ日時 | 2024-09-25 18:07:35 |
合計ジャッジ時間 | 6,594 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | TLE * 1 -- * 16 |
ソースコード
import numpy as np def convolve(f, g): fft_len = 1 while 2 * fft_len < len(f) + len(g) - 1: fft_len *= 2 fft_len *= 2 Ff = np.fft.rfft(f, fft_len) Fg = np.fft.rfft(g, fft_len) Fh = Ff * Fg h = np.fft.irfft(Fh, fft_len) h = np.rint(h).astype(np.int64) return h[:len(f) + len(g) - 1] a, b = input().split(".") X = int(a + b)//25 M = 100 ans = int(X % 4 == 0) for a in range(M + 1): for b in range(a, M + 1): if X + a + b > 600: continue dp = [0] * (M + 1) for i in range(a, b + 1): dp[i] = 1 temp = [0] * (M + 1) temp[0] = 1 for _ in range(3): temp = convolve(temp, dp) temp = convolve(temp, temp) ans += temp[X + a + b] dp[b] = 0 temp = [0] * (M + 1) temp[0] = 1 for _ in range(3): temp = convolve(temp, dp) temp = convolve(temp, temp) ans -= temp[X + a + b] dp[a] = 0 dp[b] = 1 temp = [0] * (M + 1) temp[0] = 1 for _ in range(3): temp = convolve(temp, dp) temp = convolve(temp, temp) ans -= temp[X + a + b] dp[b] = 0 temp = [0] * (M + 1) temp[0] = 1 for _ in range(3): temp = convolve(temp, dp) temp = convolve(temp, temp) ans += temp[X + a + b] print(ans)