結果

問題 No.4 おもりと天秤
ユーザー rarpipipirarpipipi
提出日時 2023-12-31 03:44:42
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 350 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 140,204 KB
最終ジャッジ日時 2023-12-31 03:44:49
合計ジャッジ時間 7,576 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 34 ms
53,460 KB
testcase_02 AC 78 ms
75,332 KB
testcase_03 AC 34 ms
53,460 KB
testcase_04 AC 34 ms
53,460 KB
testcase_05 AC 35 ms
53,460 KB
testcase_06 AC 35 ms
53,460 KB
testcase_07 AC 35 ms
53,460 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**6)
n=int(input())
w=list(map(int,input().split()))
mid=-(-sum(w)//2)

def dfs(i,le,ri):
    if i==n:
        if le==ri:
            print("possible")
            exit()
        return
    if w[i]+le<=mid:
        dfs(i+1,w[i]+le,ri)
    if w[i]+ri<=mid:
        dfs(i+1,le,w[i]+ri)

dfs(0,0,0)
print('impossible')
0