結果

問題 No.4 おもりと天秤
ユーザー Shin09shin
提出日時 2019-01-26 18:21:42
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
MLE  
実行時間 -
コード長 459 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 817,936 KB
最終ジャッジ日時 2024-09-16 16:14:12
合計ジャッジ時間 2,933 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 MLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

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

x = list(itertools.permutations(w))
c = False

if sum(w) % 2 != 0:
    print('impossible')
else:
    b = sum(w) // 2
    for var in x:
        a = 0
        for i in var:
            a += i
            if a == b:
                c = True
                break
            elif a > b:
                break
    if c:
        print('possible')
    else:
        print('impossible')
0