結果

問題 No.4 おもりと天秤
ユーザー dashi_dragonsdashi_dragons
提出日時 2017-02-14 19:32:49
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 439 bytes
コンパイル時間 98 ms
コンパイル使用メモリ 10,796 KB
実行使用メモリ 8,144 KB
最終ジャッジ日時 2023-08-28 16:53:38
合計ジャッジ時間 1,406 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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(list)):
		buf = list[j] + i
		if buf not in ans:
			ans.append(buf)

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

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