## 补充
[【评测记录】](https://www.luogu.com.cn/record/58402953)
`#5` WA 信息:
```plain
Wrong Answer. wrong answer On line 2 column 2, read 9, expected 2.
```
也就是统计 Haffman 树的最大深度出了问题?
`#5` 所有输入的 $weight$ 都相等,有没有可能是因为不同编译器对 `priority_queue` 关键字**相等**的排序处理方式不同?
by Fidel @ 2021-09-22 21:53:46
问题已解决。
每次从优先队列选取时,若 $\sum w$ 相同,则**取高度较小的一个**。
```cpp
class cmp {
public:
// overwrite comparing function
bool operator()(const Node *u1, const Node *u2) {
if (u1->w != u2->w) return u1->w > u2->w;
return u1->h > u2->h; // !! choose the tree with the minimum height
}
};
```
by Fidel @ 2021-09-27 13:40:06