結果

問題 No.3711 Udon, Tempura
コンテスト
ユーザー detteiuu
提出日時 2026-09-11 21:34:13
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 183 ms / 2,000 ms
+ 331µs
コード長 385 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 85 ms
コンパイル使用メモリ 80,640 KB
実行使用メモリ 85,376 KB
最終ジャッジ日時 2026-09-11 21:34:28
合計ジャッジ時間 5,122 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N, M = map(int, input().split())
U = list(map(int, input().split()))
T = list(map(int, input().split()))

dp = [False]*(10**5+1)
dp[0] = True
for t in T:
    for i in reversed(range(10**5+1)):
        if i+t <= 10**5:
            dp[i+t] |= dp[i]

ans = 0
dp2 = [False]*(10**5*2+1)
for u in U:
    for i in range(10**5+1):
        if dp[i]:
            dp2[u+i] = True

print(sum(dp2))
0