結果

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

ソースコード

diff #

# coding: utf-8
# Your code here!

n = int(input())
lst = list(map(int,input().split()))
total = sum(lst)
harf = total//2
l = {0}

z = False

if total%2==0:
    for i in lst:
        l_plus = {i+x for x in l}
        if harf in l_plus:
            z=True
            break
        else:
            l = l|l_plus
print("possible" if z else "impossible")
0