結果
問題 |
No.4 おもりと天秤
|
ユーザー |
👑 |
提出日時 | 2020-08-18 11:35:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 106 ms / 5,000 ms |
コード長 | 377 bytes |
コンパイル時間 | 377 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-10-12 02:34:38 |
合計ジャッジ時間 | 2,402 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
n = int(input()) wlst = list(map(int, input().split())) goal_double = sum(wlst) if goal_double % 2 == 1: print("impossible") exit() goal = goal_double // 2 dp = [False for _ in range(goal + 1)] dp[0] = True for w in wlst: for i in range(goal, w - 1, -1): if dp[i - w]: dp[i] = True if dp[-1]: print("possible") else: print("impossible")