結果

問題 No.4 おもりと天秤
ユーザー aqua_tenhou
提出日時 2021-07-11 22:24:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 386 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 67,712 KB
最終ジャッジ日時 2024-07-02 03:17:20
合計ジャッジ時間 2,345 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

d = [[0 for i in range(10**4 + 1)] for j in range(n+1)]
d[0][0] = 1

s = sum(w)
if s%2 == 1:
    print("impossible")
    exit()
for i in range(n):
    for j in range(10**4 + 1):
        if d[i][j] == 1:
            d[i+1][j] = 1
            d[i+1][j+w[i]] = 1

if d[-1][s//2] == 1:
    print("possible")
else:
    print("impossible")
0