結果

問題 No.4 おもりと天秤
ユーザー soisusoisu
提出日時 2022-09-09 16:10:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 323 bytes
コンパイル時間 384 ms
コンパイル使用メモリ 87,068 KB
実行使用メモリ 76,288 KB
最終ジャッジ日時 2023-08-16 22:37:16
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,920 KB
testcase_01 AC 76 ms
76,028 KB
testcase_02 AC 82 ms
76,000 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 75 ms
75,872 KB
testcase_07 WA -
testcase_08 AC 80 ms
75,976 KB
testcase_09 AC 81 ms
75,920 KB
testcase_10 WA -
testcase_11 AC 76 ms
75,992 KB
testcase_12 AC 76 ms
76,044 KB
testcase_13 AC 78 ms
76,008 KB
testcase_14 AC 77 ms
75,900 KB
testcase_15 AC 76 ms
75,880 KB
testcase_16 WA -
testcase_17 AC 76 ms
75,912 KB
testcase_18 AC 82 ms
76,048 KB
testcase_19 AC 82 ms
76,044 KB
testcase_20 AC 81 ms
75,964 KB
testcase_21 AC 82 ms
75,908 KB
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

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