結果

問題 No.4 おもりと天秤
ユーザー dashi_dragonsdashi_dragons
提出日時 2017-02-14 19:39:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 435 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,964 KB
実行使用メモリ 12,864 KB
最終ジャッジ日時 2023-08-28 16:54:24
合計ジャッジ時間 6,703 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,960 KB
testcase_01 AC 15 ms
8,208 KB
testcase_02 AC 19 ms
7,840 KB
testcase_03 AC 15 ms
7,740 KB
testcase_04 AC 31 ms
7,952 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

N = int(input())
W = input().split(' ')
median = 0
list = []
ans = []

for i in range(0,len(W)):
	W[i] = int(W[i])
	median += W[i]
	list.append(0)

if median % 2 == 1:
	print('impossible')
	sys.exit()

median = median // 2

for i in W:
	for j in range(0,len(ans)):
		buf = ans[j] + i
		if buf not in ans:
			ans.append(buf)

	if i not in ans:
		ans.append(i)

if median in ans:
	print('possible')
else:
	print('impossible')
0