結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2017-12-21 16:15:15 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 135 ms / 5,000 ms |
コード長 | 333 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-06-26 10:25:59 |
合計ジャッジ時間 | 2,051 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
n=int(input()) w=list(map(int,input().split())) if sum(w)%2!=0: print("impossible") else: total=int(sum(w)/2) dp=[False]*(total+1) dp[0]=True for i in w: for j in reversed(range(i-1,total+1)): dp[j] |= dp[j-i] if dp[total]: print("possible") else: print("impossible")