結果
問題 | No.4 おもりと天秤 |
ユーザー |
![]() |
提出日時 | 2015-02-09 07:48:06 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 96 ms / 5,000 ms |
コード長 | 336 bytes |
コンパイル時間 | 214 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-26 09:05:18 |
合計ジャッジ時間 | 2,190 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
import math N = int(raw_input()) W = map(int, raw_input().split()) S=0 for w in W: S+=w if S%2 != 0: print "impossible" exit() W.sort() L = [False for i in range(S+1)] L[0]=True for w in W: for i in range(S,-1,-1): if L[i] and i+w <=S: L[i+w]=True if L[S/2]: print "possible" else: print "impossible"