結果

問題 No.4 おもりと天秤
ユーザー JunOnuma
提出日時 2017-06-14 13:29:20
言語 Python2
(2.7.18)
結果
AC  
実行時間 115 ms / 5,000 ms
コード長 290 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-26 10:19:14
合計ジャッジ時間 2,581 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(raw_input())
l = map(int, raw_input().split())
ls = [False for _ in range(100*n+1)]
ls[0] = True
for w in l:
    for i in range(100*n,-1,-1):
        if ls[i]:
            ls[i+w] = True
if sum(l) % 2 == 1 or ls[sum(l)/2] == False:
    print 'impossible'
else:
    print 'possible'
0