結果
問題 |
No.4 おもりと天秤
|
ユーザー |
![]() |
提出日時 | 2016-04-12 22:51:58 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 268 bytes |
コンパイル時間 | 54 ms |
コンパイル使用メモリ | 6,948 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 05:58:51 |
合計ジャッジ時間 | 1,258 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 4 |
ソースコード
n=input() w=sorted(map(int,raw_input().split()))[::-1] s=sum(w) if s&1: print"impossible" exit() s/=2 def solve(a,b): if a>=n: return False c=b+w[a] if c>s: return solve(a+1,b) if c==s: return True return solve(a+1,c) print["im",""][solve(0,0)]+"possible"