結果

問題 No.4 おもりと天秤
コンテスト
ユーザー Shin09shin
提出日時 2019-01-26 18:22:58
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
MLE  
実行時間 -
コード長 451 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 417 ms
コンパイル使用メモリ 20,700 KB
実行使用メモリ 1,306,264 KB
最終ジャッジ日時 2026-04-05 20:53:42
合計ジャッジ時間 2,259 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 MLE * 2 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import itertools

n = int(input())
w = 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