結果
| 問題 | No.4 おもりと天秤 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-01-15 14:19:26 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 5,000 ms |
| コード長 | 337 bytes |
| 記録 | |
| コンパイル時間 | 242 ms |
| コンパイル使用メモリ | 85,760 KB |
| 実行使用メモリ | 72,064 KB |
| 最終ジャッジ日時 | 2026-06-02 12:44:29 |
| 合計ジャッジ時間 | 1,839 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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")