結果

問題 No.4 おもりと天秤
ユーザー i_takui_taku
提出日時 2023-09-29 09:33:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 116 ms / 5,000 ms
コード長 251 bytes
コンパイル時間 671 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 76,528 KB
最終ジャッジ日時 2023-09-29 09:33:26
合計ジャッジ時間 3,606 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
76,312 KB
testcase_01 AC 79 ms
76,292 KB
testcase_02 AC 83 ms
76,520 KB
testcase_03 AC 83 ms
76,316 KB
testcase_04 AC 82 ms
76,228 KB
testcase_05 AC 116 ms
76,288 KB
testcase_06 AC 78 ms
76,172 KB
testcase_07 AC 99 ms
76,296 KB
testcase_08 AC 93 ms
76,256 KB
testcase_09 AC 98 ms
76,380 KB
testcase_10 AC 99 ms
76,280 KB
testcase_11 AC 83 ms
76,332 KB
testcase_12 AC 78 ms
76,436 KB
testcase_13 AC 79 ms
76,092 KB
testcase_14 AC 78 ms
76,288 KB
testcase_15 AC 80 ms
76,164 KB
testcase_16 AC 90 ms
76,252 KB
testcase_17 AC 81 ms
76,112 KB
testcase_18 AC 100 ms
76,108 KB
testcase_19 AC 98 ms
76,528 KB
testcase_20 AC 101 ms
76,336 KB
testcase_21 AC 102 ms
76,348 KB
testcase_22 AC 104 ms
76,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
W = list(map(int, input().split()))
dp = [False] * (1 << 15)
dp[0] = True
for i in range(N):
    for j in range(1 << 14, -1, -1):
        dp[j] |= dp[j - W[i]]
print('possible' if sum(W) & 1 == 0 and dp[sum(W) // 2] else 'impossible')
0