結果

問題 No.4 おもりと天秤
ユーザー goto_isyukugoto_isyuku
提出日時 2017-05-28 23:13:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
MLE  
実行時間 -
コード長 625 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 11,888 KB
実行使用メモリ 733,952 KB
最終ジャッジ日時 2023-10-21 14:39:51
合計ジャッジ時間 7,412 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
14,528 KB
testcase_01 AC 22 ms
10,180 KB
testcase_02 MLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = input()

wl = [int(x) for x in input().split()]

if sum(wl) % 2 == 1:
    print("impossible")
else:

    obj_sum = sum(wl) // 2
    
    x = True
    tmp = [[[], 0]]
    cnt = 0

    while x and cnt < len(wl) - 1:
        new_tmp = []

        for t in tmp:
            for i in range(len(wl)):
                if i not in t[0]:
                    new_tmp.append([t[0] + [i], t[1] + wl[i]])
        
        for i in new_tmp:
            if i[1] == obj_sum:
                x = False
                break

        cnt += 1
        tmp = new_tmp

    if x:
        print("impossible")
    else:
        print("possible")
0