結果

問題 No.4 おもりと天秤
ユーザー soisu
提出日時 2022-09-09 16:10:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 323 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 61,580 KB
最終ジャッジ日時 2024-11-25 13:49:26
合計ジャッジ時間 2,284 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 16 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)
inf=float('inf')

N=int(input())
W=list(map(int,input().split()))
sm=sum(W)

M=10101
dp=[False]*(M+1)
dp[0]=True

for i in range(N):
    for w in range(M,0,-1):
        if W[i]<=w:
            dp[w]=dp[w-W[i]]

ans="impossible"
if sm%2==0 and dp[sm//2]:
    ans="possible"
print(ans)
0