結果

問題 No.4 おもりと天秤
ユーザー Kiri8128Kiri8128
提出日時 2020-09-06 00:03:05
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 207 bytes
コンパイル時間 726 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 71,448 KB
最終ジャッジ日時 2023-08-19 13:17:08
合計ジャッジ時間 4,011 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,228 KB
testcase_01 AC 74 ms
71,080 KB
testcase_02 AC 73 ms
71,448 KB
testcase_03 AC 74 ms
71,420 KB
testcase_04 AC 76 ms
71,236 KB
testcase_05 AC 75 ms
71,208 KB
testcase_06 AC 74 ms
71,248 KB
testcase_07 AC 74 ms
70,940 KB
testcase_08 AC 75 ms
71,208 KB
testcase_09 AC 76 ms
70,940 KB
testcase_10 AC 73 ms
71,192 KB
testcase_11 AC 76 ms
71,360 KB
testcase_12 AC 74 ms
71,288 KB
testcase_13 AC 75 ms
71,080 KB
testcase_14 AC 74 ms
71,116 KB
testcase_15 AC 75 ms
71,384 KB
testcase_16 AC 76 ms
71,080 KB
testcase_17 AC 76 ms
71,048 KB
testcase_18 AC 73 ms
70,936 KB
testcase_19 AC 76 ms
71,300 KB
testcase_20 AC 75 ms
71,228 KB
testcase_21 AC 75 ms
71,180 KB
testcase_22 AC 75 ms
71,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
W = [int(a) for a in input().split()]
su = sum(W)
if su & 1:
    print("impossible")
    exit()

s = 1 << (su // 2)
for w in W:
    s |= s >> w

print("possible" if s & 1 else "impossible")
0