版本比较
SPN Round 02 题解
正文
增加 3 行删除 3 行
102 行未改动全部展开10310410510610710710810911011111211311411411511611711889 行未改动208209210211212212213214215216197 行未改动全部展开102 行未改动全部展开 struct node { int to, dis; node() : to(0), dis(0) {} node(int x, int y) : to(x), dis(y) {}
bool operator< (const node& other) const { return dis > other.dis; } }; priority_queue<node> q; int dis[N];
inline void dijkstra(int s) { memset(dis, 0x3f, sizeof(dis)); dis[s] = 0; q.emplace(s, 0);89 行未改动考虑用数据结构优化转移。$f_{i-1,j,k} \to f_{i,j,k}$ 是平凡的,剩下两个转移描述了 $j,k$ 之间的相互作用。对于 $j,k$ 两维各自维护 $V$ 棵线段树,转移就是一个区间和 / 区间 max 的形式,支持单点修改即可。复杂度 $O(V^2 \log V)$。
## 100pts
做到这一步应该都会了。我们只关注 $a_i$ 的相对大小,所以离散化一下就行了。复杂度 $O(n^2 \log n)$。 做到这一步应该都会了。我们只关注 $a_i$ 的相对大小,所以离散化一下就行了。复杂度 $O(n^2 \log n)$。
# Divine Sets Count
- 标签:位运算、组合数学、计数 DP、NTT 等。197 行未改动全部展开