結果

問題 No.4 おもりと天秤
ユーザー takakin
提出日時 2020-03-28 20:18:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 214 ms / 5,000 ms
コード長 313 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2025-01-02 12:08:03
合計ジャッジ時間 3,858 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
DP=[False]*(10**4+1)
DP[0]=True
for i,a in enumerate(A):
  for j in range(a,10**4+1)[::-1]:
    if DP[j-a]:
      DP[j]=True
if sum(A)%2==0 and DP[sum(A)//2]:
  print("possible")
else:
  print("impossible")
0