結果

問題 No.4 おもりと天秤
ユーザー syunsuke1024syunsuke1024
提出日時 2020-05-05 17:03:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 279 bytes
コンパイル時間 262 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 71,512 KB
最終ジャッジ日時 2023-09-09 04:26:48
合計ジャッジ時間 2,971 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,088 KB
testcase_01 AC 70 ms
71,276 KB
testcase_02 AC 73 ms
71,388 KB
testcase_03 AC 72 ms
71,296 KB
testcase_04 AC 76 ms
71,488 KB
testcase_05 AC 72 ms
71,356 KB
testcase_06 AC 70 ms
71,208 KB
testcase_07 AC 72 ms
71,428 KB
testcase_08 AC 72 ms
71,512 KB
testcase_09 AC 72 ms
71,088 KB
testcase_10 AC 72 ms
71,484 KB
testcase_11 AC 73 ms
71,296 KB
testcase_12 AC 73 ms
71,344 KB
testcase_13 AC 72 ms
71,368 KB
testcase_14 AC 73 ms
71,340 KB
testcase_15 AC 73 ms
71,300 KB
testcase_16 AC 72 ms
71,116 KB
testcase_17 AC 73 ms
71,372 KB
testcase_18 AC 72 ms
71,316 KB
testcase_19 AC 73 ms
71,220 KB
testcase_20 AC 72 ms
71,312 KB
testcase_21 AC 74 ms
71,392 KB
testcase_22 AC 72 ms
71,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
W=list(map(int,input().split()))
if sum(W)%2==1:
    print("impossible")
    exit()
SUM=1
for i in range(N):
    SUM=SUM | SUM<<W[i]
SUM=str(bin(SUM))
SUM=SUM[::-1]
#print(SUM)
if SUM[sum(W)//2]=="1":
    print("possible")
else:
    print("impossible")
#print(SUM)
0