結果

問題 No.4 おもりと天秤
コンテスト
ユーザー aaaaaaaaaa2230
提出日時 2021-04-05 10:26:56
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 29 ms / 5,000 ms
+ 446µs
コード長 272 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 257 ms
コンパイル使用メモリ 82,484 KB
実行使用メモリ 62,744 KB
最終ジャッジ日時 2026-10-09 15:47:37
合計ジャッジ時間 2,226 ms
ジャッジサーバーID
(参考情報)
judge5_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
W = list(map(int,input().split()))
M = 10**4
dp = [0]*(M+5)

dp[0] = 1
for w in W:
    for i in range(M)[::-1]:
        if dp[i] and i+w <= M:
            dp[i+w] = 1
s = sum(W)
if s%2 == 0 and dp[s//2]:
    print("possible")
else:
    print("impossible")
0