結果

問題 No.4 おもりと天秤
ユーザー daleksprinterdaleksprinter
提出日時 2018-09-02 00:52:59
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 328 bytes
コンパイル時間 60 ms
コンパイル使用メモリ 7,108 KB
実行使用メモリ 6,684 KB
最終ジャッジ日時 2023-10-21 23:12:05
合計ジャッジ時間 1,679 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,492 KB
testcase_01 AC 11 ms
6,492 KB
testcase_02 AC 13 ms
6,500 KB
testcase_03 AC 12 ms
6,492 KB
testcase_04 AC 14 ms
6,500 KB
testcase_05 AC 73 ms
6,588 KB
testcase_06 AC 11 ms
6,492 KB
testcase_07 AC 71 ms
6,588 KB
testcase_08 AC 11 ms
6,492 KB
testcase_09 AC 97 ms
6,684 KB
testcase_10 AC 78 ms
6,600 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 11 ms
6,492 KB
testcase_14 WA -
testcase_15 AC 11 ms
6,492 KB
testcase_16 AC 11 ms
6,492 KB
testcase_17 AC 11 ms
6,492 KB
testcase_18 AC 65 ms
6,580 KB
testcase_19 AC 65 ms
6,576 KB
testcase_20 AC 65 ms
6,576 KB
testcase_21 AC 61 ms
6,568 KB
testcase_22 AC 62 ms
6,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

arr = map(int,raw_input().split())

accumlate = sum(arr)
if accumlate %2 == 1:
	print 'impossible'
	quit()

dp = [0 for i in range(accumlate/2 + 1)]
dp[0] = 1

for i in arr:
	for j in range(accumlate/2+1):
		if j - i > -1 and dp[j-i] == 1:
			dp[j] = 1

print 'possible' if dp[accumlate/2] else 'impossible'


0