結果
問題 |
No.4 おもりと天秤
|
ユーザー |
|
提出日時 | 2023-01-15 14:19:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 70 ms / 5,000 ms |
コード長 | 337 bytes |
コンパイル時間 | 802 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 71,680 KB |
最終ジャッジ日時 | 2024-12-28 06:12:14 |
合計ジャッジ時間 | 2,829 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 23 |
ソースコード
n=int(input()) W=list(map(int,input().split())) sum_W=sum(W) if sum_W%2==1: print("impossible") exit() target=sum_W//2 box=set([0]) for w in W: n_box=set() for b in box: if b+w<=target: n_box.add(b+w) box|=n_box if target in box: print("possible") exit() print("impossible")