結果

問題 No.4 おもりと天秤
ユーザー tookunn_1213
提出日時 2015-08-16 13:39:22
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 6,940 KB
実行使用メモリ 13,216 KB
最終ジャッジ日時 2024-07-18 09:50:45
合計ジャッジ時間 6,657 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 WA * 2 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(raw_input())
W = map(int,raw_input().split())
queue = [0,0,0]
ans = 0
while len(queue) > 0:
	i,a,b = queue.pop(),queue.pop(),queue.pop()
	if i == N and a == b:
		ans = 1
		break
	if i >= N:continue
	queue.append(i + 1)
	queue.append(a + W[i])
	queue.append(b)
	queue.append(i + 1)
	queue.append(a)
	queue.append(b + W[i])
if ans == 0:
	print 'impossible'
else:
	print 'possible'
0