結果

問題 No.4 おもりと天秤
ユーザー tookunn_1213tookunn_1213
提出日時 2015-08-16 22:07:28
言語 Python2
(2.7.18)
結果
RE  
実行時間 -
コード長 388 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 6,464 KB
実行使用メモリ 9,796 KB
最終ジャッジ日時 2023-09-25 12:28:05
合計ジャッジ時間 1,685 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,368 KB
testcase_01 AC 11 ms
5,924 KB
testcase_02 AC 128 ms
9,796 KB
testcase_03 AC 13 ms
6,424 KB
testcase_04 AC 43 ms
9,684 KB
testcase_05 RE -
testcase_06 AC 11 ms
5,980 KB
testcase_07 RE -
testcase_08 AC 11 ms
5,924 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 11 ms
6,204 KB
testcase_12 AC 11 ms
6,192 KB
testcase_13 AC 12 ms
6,364 KB
testcase_14 AC 12 ms
6,304 KB
testcase_15 AC 12 ms
6,200 KB
testcase_16 AC 12 ms
6,324 KB
testcase_17 AC 12 ms
6,288 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
N = int(raw_input())
W = map(int,raw_input().split())
sumw = sum(W)
if sumw % 2  == 1:
	print 'impossible'
else:
	ans = -1
	W.sort()
	binList = [('{:0'+str(N)+'b}').format(i) for i in range(int(math.pow(2,N)))]
	for b in binList:
		ssum = sum([W[i] for i in range(N) if b[i] == '1'])
		if ssum == sumw / 2:
			ans = 0
			break
	print ('possible' if ans == 0 else 'impossible')
0