結果

問題 No.4 おもりと天秤
ユーザー convexineq
提出日時 2020-11-22 23:51:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 202 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 53,576 KB
最終ジャッジ日時 2024-07-23 16:49:44
合計ジャッジ時間 2,142 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.readline
read = sys.stdin.read

n,*w = map(int,read().split())
dp = 1
for i in w:
    dp |= dp<<i
print("possible" if sum(w)%2==0 and dp>>(sum(w)//2)&1 else "impossible")
0