結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2017-12-20 00:19:07 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 96 ms / 5,000 ms |
コード長 | 431 bytes |
コンパイル時間 | 75 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,496 KB |
最終ジャッジ日時 | 2024-06-26 10:25:25 |
合計ジャッジ時間 | 1,987 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
n=int(input()) w=list(map(int,input().split())) if sum(w)%2!=0: print("impossible") else: w_i=sum(w)//2 weight=set([0]) w.sort() while 0<len(w): crt_weight=w.pop() tmp_set=set() for i in weight: if i+crt_weight<=w_i: tmp_set.add(i+crt_weight) weight.update(tmp_set) if w_i in weight: print("possible") else: print("impossible")