結果
| 問題 | No.4 おもりと天秤 | 
| コンテスト | |
| ユーザー |  taba | 
| 提出日時 | 2016-04-12 23:25:10 | 
| 言語 | Python2 (2.7.18) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 296 ms / 5,000 ms | 
| コード長 | 330 bytes | 
| コンパイル時間 | 56 ms | 
| コンパイル使用メモリ | 6,940 KB | 
| 実行使用メモリ | 6,784 KB | 
| 最終ジャッジ日時 | 2024-06-26 09:28:27 | 
| 合計ジャッジ時間 | 2,582 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
n=input() w=sorted(map(int,raw_input().split()))[::-1] s=sum(w) if s&1: print"impossible" exit() s/=2 if s in w: print"possible" exit() t=[0]*(s+1) for i in range(n): nt=t[:] tw=w[i] for j in range(s): if j+tw<=s and t[j]+tw<=s: nt[j+tw]=max(t[j+tw],t[j]+tw) t=nt #print t #print s print["im",""][s==t[-1]]+"possible"
