結果

問題 No.3711 Udon, Tempura
コンテスト
ユーザー Unbakedbread
提出日時 2026-09-13 21:40:21
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 429 ms / 2,000 ms
+ 346µs
コード長 316 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 70 ms
コンパイル使用メモリ 80,768 KB
実行使用メモリ 85,120 KB
最終ジャッジ日時 2026-09-13 21:40:37
合計ジャッジ時間 7,976 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()))

S = sum(T) + 10
dp = [i == 0 for i in range(S)]
for x in T:
	for c in range(S - x - 1, -1, -1):
		dp[c + x] |= dp[c]

print(sum(any(0 <= t - U[i] < S and dp[t - U[i]] for i in range(N)) for t in range(202020)))
0