結果

問題 No.4 おもりと天秤
コンテスト
ユーザー taba
提出日時 2016-04-12 22:51:58
言語 PyPy2
(7.3.15)
結果
WA  
実行時間 -
コード長 268 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 158 ms
コンパイル使用メモリ 77,340 KB
最終ジャッジ日時 2025-12-03 20:08:34
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n=input()
w=sorted(map(int,raw_input().split()))[::-1]
s=sum(w)
if s&1:
	print"impossible"
	exit()
s/=2
def solve(a,b):
	if a>=n:
		return False
	c=b+w[a]
	if c>s:
		return solve(a+1,b)
	if c==s:
		return True
	return solve(a+1,c)
print["im",""][solve(0,0)]+"possible"
0