結果

問題 No.4 おもりと天秤
ユーザー ゆるく
提出日時 2014-11-09 01:38:27
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 421 ms / 5,000 ms
コード長 443 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 12,032 KB
最終ジャッジ日時 2024-06-26 09:03:57
合計ジャッジ時間 6,121 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy

d = defaultdict(int)
n = int(input())
w = tuple(int(i) for i in input().split())
s = sum(w)

d[0] = 1
for ww in w:
  for i in range(10000, -1, -1):
    d[i + ww] |= d[i]

print("possible" if s % 2 == 0 and d[s / 2] else "impossible")
0