版本比较
题解:P17381 [PacNW 2025] Closest Equal Pair
正文
增加 2 行删除 0 行
9 行未改动101112131415161789 行未改动1071081091101111121131141159 行未改动这个显然是可以通过线段树快速维护的,不过实现相对复杂,除普通线段树外还需要记录每一个子树内有多少个点有值。### Code:::success[AC]#include <bits/stdc++.h>using namespace std;#define int long longconst int maxn = 4e5 + 10;89 行未改动}cout << ans;return 0;}:::### The Last膜拜三个陪我一起做题的同学 [Zhangc666](https://www.luogu.com.cn/user/1426323),[_lxm](https://www.luogu.com.cn/user/1011696),[pjkpjkpjk](https://www.luogu.com.cn/user/1498804)。好像说第一个人比我更早想出正解,但是不会线段树优化 DP,所以我更早过。9 行未改动10111213141516171889 行未改动1081091101111121131141151161179 行未改动这个显然是可以通过线段树快速维护的,不过实现相对复杂,除普通线段树外还需要记录每一个子树内有多少个点有值。### Code:::success[AC]```#include <bits/stdc++.h>using namespace std;#define int long longconst int maxn = 4e5 + 10;89 行未改动}cout << ans;return 0;}```:::### The Last膜拜三个陪我一起做题的同学 [Zhangc666](https://www.luogu.com.cn/user/1426323),[_lxm](https://www.luogu.com.cn/user/1011696),[pjkpjkpjk](https://www.luogu.com.cn/user/1498804)。好像说第一个人比我更早想出正解,但是不会线段树优化 DP,所以我更早过。