結果
| 問題 | No.4 おもりと天秤 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-04-25 02:14:57 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 476 bytes | 
| コンパイル時間 | 164 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 115,840 KB | 
| 最終ジャッジ日時 | 2024-07-04 09:22:36 | 
| 合計ジャッジ時間 | 7,880 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 18 TLE * 1 -- * 4 | 
ソースコード
import sys
sys.setrecursionlimit(10**7)
def dfs(idx,w):
    if idx == N:
        return
    if w + W[idx] == total_w/2:
        print("possible")
        exit()
    elif w + W[idx] < total_w/2:
        dfs(idx+1,w+W[idx])
        dfs(idx+1,w)
    else:
        dfs(idx+1,w)
N = int(input())
W = list(map(int,input().split()))
total_w = sum(W)
if total_w/2 != total_w//2:
    print("impossible")
    exit()
seen = set([])
dfs(0,0)
print("impossible")
            
            
            
        