結果

問題 No.4 おもりと天秤
ユーザー cleanttedcleantted
提出日時 2016-09-11 10:08:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 436 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2024-04-28 10:14:45
合計ジャッジ時間 2,756 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 27 ms
10,752 KB
testcase_02 AC 29 ms
10,624 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 131 ms
13,056 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 32 ms
10,624 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 25 ms
10,752 KB
testcase_12 AC 24 ms
10,624 KB
testcase_13 AC 25 ms
10,624 KB
testcase_14 AC 25 ms
10,752 KB
testcase_15 AC 25 ms
10,624 KB
testcase_16 WA -
testcase_17 AC 26 ms
10,752 KB
testcase_18 AC 121 ms
12,928 KB
testcase_19 AC 111 ms
12,800 KB
testcase_20 AC 114 ms
12,800 KB
testcase_21 AC 108 ms
12,416 KB
testcase_22 AC 107 ms
12,672 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
V = list(map(int, input().split()))

total = sum(V)
han = total // 2
if total % 2 == 1: print("impossible")
else:
    done = [[0 for i in range(han)] for j in range(N+1)]
    done[N][0] = 1
    for i in range(N):
        for u in range(han):
            if u < V[i]: done[i][u] = done[i-1][u]
            else: done[i][u] = done[i-1][u-V[i]]
    if done[N-1][han-1] == 1: print("possible")
    else: print("impossible")
0