結果

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

ソースコード

diff #

n = int(input())
w = list(map(int, input().split()))

summation = sum(w)
l = {0}
z = False

if sum(w)%2==0:
    for i in w:
        l_plus = {i + x for x in l}
        if summation / 2 in l_plus:
            z = True
            break
        l = l|l_plus
print('possible' if z else 'impossible')
0