結果

問題 No.4 おもりと天秤
ユーザー Shirapon_pon
提出日時 2021-11-09 12:11:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 59,136 KB
最終ジャッジ日時 2024-11-18 09:23:05
合計ジャッジ時間 1,729 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

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

all_pattern = itertools.combinations_with_replacement("rl",n)

for p in all_pattern:
    right = 0
    left = 0
    possibility = "impossible"
    for i in range(n):
        if p[i] == "r":
            right += w[i]
        else:
            left += w[i]
    if right == left:
        possibility = "possible"
        break

print(possibility)
0