結果
問題 |
No.4 おもりと天秤
|
ユーザー |
![]() |
提出日時 | 2019-09-01 09:49:16 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 46 ms / 5,000 ms |
コード長 | 365 bytes |
コンパイル時間 | 386 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-27 12:44:48 |
合計ジャッジ時間 | 1,759 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
def solve(): N, *W = map(int, open(0).read().split()) q, r = divmod(sum(W), 2) if r == 1: return False dp = [False] * (q + 110) dp[0] = True for w in W: for i in reversed(range(q + 1)): if dp[i]: dp[i + w] = True return dp[q] if solve(): print("possible") else: print("impossible")