結果
問題 |
No.4 おもりと天秤
|
ユーザー |
![]() |
提出日時 | 2016-04-12 22:54:43 |
言語 | Python2 (2.7.18) |
結果 |
TLE
|
実行時間 | - |
コード長 | 312 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 13,092 KB |
最終ジャッジ日時 | 2024-10-04 06:00:35 |
合計ジャッジ時間 | 7,070 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 TLE * 1 -- * 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 d=solve(a+1,c) if d==False: return solve(a+1,b) return True print["im",""][solve(0,0)]+"possible"