結果

問題 No.4 おもりと天秤
ユーザー miho-4miho-4
提出日時 2023-04-08 07:43:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 254 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 82,424 KB
実行使用メモリ 60,500 KB
最終ジャッジ日時 2024-04-14 07:04:39
合計ジャッジ時間 2,301 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,040 KB
testcase_01 AC 37 ms
52,060 KB
testcase_02 AC 37 ms
51,828 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 37 ms
53,692 KB
testcase_07 WA -
testcase_08 AC 37 ms
53,004 KB
testcase_09 AC 42 ms
59,544 KB
testcase_10 WA -
testcase_11 AC 36 ms
52,372 KB
testcase_12 AC 37 ms
52,892 KB
testcase_13 AC 37 ms
51,940 KB
testcase_14 AC 37 ms
52,828 KB
testcase_15 AC 37 ms
52,792 KB
testcase_16 WA -
testcase_17 AC 37 ms
52,212 KB
testcase_18 AC 42 ms
59,876 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
L=list(map(int,input().split()))
T=sum(L)
if T%2==1:exit(print("impossible"))
S={0}
for i in range(n):
    nx={0}
    for e in S:
        if e+L[i]<=T//2:
            nx.add(e+L[i])
    S=nx
print("possible" if T//2 in S else "impossible")
0