結果

問題 No.4 おもりと天秤
ユーザー hiro_hiro_hirophiro_hiro_hirop
提出日時 2018-06-04 22:48:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 299 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 9,288 KB
最終ジャッジ日時 2023-09-12 22:18:33
合計ジャッジ時間 1,550 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,852 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 15 ms
7,776 KB
testcase_04 AC 15 ms
7,848 KB
testcase_05 AC 24 ms
8,968 KB
testcase_06 WA -
testcase_07 AC 24 ms
9,288 KB
testcase_08 WA -
testcase_09 AC 16 ms
7,992 KB
testcase_10 AC 24 ms
9,204 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 15 ms
7,936 KB
testcase_17 AC 14 ms
7,776 KB
testcase_18 WA -
testcase_19 AC 22 ms
8,760 KB
testcase_20 AC 21 ms
8,688 KB
testcase_21 AC 21 ms
8,864 KB
testcase_22 AC 21 ms
8,916 KB
権限があれば一括ダウンロードができます

ソースコード

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 True else 'impossible')
0