結果

問題 No.4 おもりと天秤
ユーザー tabataba
提出日時 2016-04-12 23:15:17
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 263 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 23:59:47
合計ジャッジ時間 2,044 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 10 ms
6,940 KB
testcase_02 AC 13 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 11 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 11 ms
6,944 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 11 ms
6,940 KB
testcase_12 AC 11 ms
6,940 KB
testcase_13 AC 11 ms
6,944 KB
testcase_14 AC 11 ms
6,944 KB
testcase_15 AC 11 ms
6,940 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 101 ms
6,944 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n=input()
w=sorted(map(int,raw_input().split()))[::-1]
s=sum(w)
if s&1:
	print"impossible"
	exit()
s/=2
t=[0]*s
for i in range(n):
	nt=t[:]
	tw=w[i]
	for j in range(s-tw):
		nt[j+tw]=max(t[j+tw],t[j]+tw)
	t=nt
#print s
#print t
print["im",""][s==t[-1]]+"possible"
0