結果

問題 No.4 おもりと天秤
ユーザー bauer24bauer24
提出日時 2017-03-12 14:09:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 541 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,824 KB
実行使用メモリ 8,316 KB
最終ジャッジ日時 2023-09-12 11:58:28
合計ジャッジ時間 8,402 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,952 KB
testcase_01 AC 17 ms
7,956 KB
testcase_02 WA -
testcase_03 AC 15 ms
7,800 KB
testcase_04 AC 17 ms
7,828 KB
testcase_05 AC 875 ms
7,828 KB
testcase_06 WA -
testcase_07 AC 938 ms
7,876 KB
testcase_08 AC 16 ms
7,804 KB
testcase_09 AC 16 ms
7,832 KB
testcase_10 AC 1,020 ms
8,316 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 16 ms
7,804 KB
testcase_17 AC 16 ms
7,812 KB
testcase_18 WA -
testcase_19 AC 667 ms
7,960 KB
testcase_20 AC 631 ms
7,792 KB
testcase_21 AC 680 ms
7,800 KB
testcase_22 AC 625 ms
7,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [int(i) for i in input().split()]
#print(n,a)
log = []
if sum(a) % 2 == 1:
    print("impossible")
else:
    half = sum(a) / 2
    for i in range(n):
        l = len(log)
        if a[i] not in log:
            log.append(a[i])
        for j in range(l):
            b = a[i] + log[j]
            if b not in log:
                log.append(b)
        #print(i,log,half)
        if half in log:
            print("possible")
            break
        else:
            if i == (n-1):
                print("impossibleB")
0