結果

問題 No.4 おもりと天秤
ユーザー yuuki1036
提出日時 2018-11-05 12:11:30
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 293 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-11-20 20:10:40
合計ジャッジ時間 1,668 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
W = list(map(int,input().split()))
S = sum(W)
if S % 2 == 1:
    print('impossible')
else:
    w_li = set([0])
    for i in W:
        w_li |= { i + w for w in w_li }
        if S/2 in w_li:
            print('possible')
            break
    else:
        print('impossible')
0