結果

問題 No.4 おもりと天秤
ユーザー mimiusmimius
提出日時 2017-04-05 14:32:38
言語 Python2
(2.7.18)
結果
AC  
実行時間 103 ms / 5,000 ms
コード長 313 bytes
コンパイル時間 790 ms
コンパイル使用メモリ 6,704 KB
実行使用メモリ 6,136 KB
最終ジャッジ日時 2023-09-08 17:23:46
合計ジャッジ時間 2,766 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
6,116 KB
testcase_01 AC 14 ms
6,088 KB
testcase_02 AC 20 ms
5,940 KB
testcase_03 AC 17 ms
6,056 KB
testcase_04 AC 21 ms
5,996 KB
testcase_05 AC 99 ms
6,016 KB
testcase_06 AC 12 ms
5,940 KB
testcase_07 AC 100 ms
5,996 KB
testcase_08 AC 74 ms
6,072 KB
testcase_09 AC 74 ms
6,000 KB
testcase_10 AC 103 ms
6,104 KB
testcase_11 AC 16 ms
6,040 KB
testcase_12 AC 13 ms
6,112 KB
testcase_13 AC 13 ms
5,960 KB
testcase_14 AC 14 ms
5,932 KB
testcase_15 AC 14 ms
6,088 KB
testcase_16 AC 16 ms
6,024 KB
testcase_17 AC 16 ms
6,036 KB
testcase_18 AC 88 ms
6,116 KB
testcase_19 AC 98 ms
5,912 KB
testcase_20 AC 97 ms
6,084 KB
testcase_21 AC 96 ms
6,136 KB
testcase_22 AC 97 ms
5,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8

iin = int(raw_input())
iiw = map(int, raw_input().split())

Max = 100*100

dp = [False]*(Max+1)
dp[0] = True
sum = 0

for x in iiw:
    sum += x
    for i in xrange(Max, -1, -1):
	    if dp[i] : dp[i+x] = True

if ((sum%2==0) and dp[sum/2]) : 
    print "possible"
else : 
    print "impossible"
0