秋招模拟赛第38场|2023.08.30-华为秋招第二场
- Status
- Done
- Rule
- IOI
- Problem
- 3
- Start at
- 2023-9-5 19:00
- End at
- 2023-9-5 21:00
- Duration
- 2 hour(s)
- Host
- Partic.
- 43
No testdata at current.
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
建立一个满二叉树,从下往上建树,每个节点存储当前最大值和最小值,叶子结点最大值和最小值一样,没个节点只需要考虑自己的左孩子和右孩子。由两个孩子来更新自身的最大值和最小值。从下往上建树后从上向下DFS,每层携带一个参数表示所有父亲的值的和。
C++
#include <bits/stdc++.h>
本题属于以下题库,请选择所需题库进行购买