結果
| 問題 |
No.4 おもりと天秤
|
| コンテスト | |
| ユーザー |
rarpipipi
|
| 提出日時 | 2023-12-31 03:44:42 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 350 bytes |
| コンパイル時間 | 345 ms |
| コンパイル使用メモリ | 82,492 KB |
| 実行使用メモリ | 75,452 KB |
| 最終ジャッジ日時 | 2024-09-27 17:00:51 |
| 合計ジャッジ時間 | 7,608 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 8 TLE * 1 -- * 14 |
ソースコード
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')
rarpipipi