結果
| 問題 |
No.398 ハーフパイプ(2)
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-11-02 12:59:37 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,345 bytes |
| コンパイル時間 | 400 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 44,792 KB |
| 最終ジャッジ日時 | 2024-09-25 18:09:29 |
| 合計ジャッジ時間 | 35,178 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 TLE * 9 |
ソースコード
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 + 1, M + 1):
if X + a + b >= 6 * b:
continue
if X + a + b <= 6 * a:
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
temp2 = convolve(dp, dp)
temp4 = convolve(temp2, temp2)
temp6 = convolve(temp4, temp2)
ans -= temp6[X + a + b]
dp[a] = 0
dp[b] = 1
temp2 = convolve(dp, dp)
temp4 = convolve(temp2, temp2)
temp6 = convolve(temp4, temp2)
ans -= temp6[X + a + b]
dp[b] = 0
temp2 = convolve(dp, dp)
temp4 = convolve(temp2, temp2)
temp6 = convolve(temp4, temp2)
ans += temp6[X + a + b]
print(ans)
rlangevin