摘要: SPLAY#include#include#include#define N 1000005using namespace std;int ch[N][2],f[N],size[N],cnt[N],key[N],root,sz;inline void clear(in... 阅读全文
posted @ 2017-07-12 15:05 Ren_Ivan 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 有两种情况需要考虑1.链:可以发现对最终的k没有影响2.环:如果是真环(即1->2->3->4->1),可以看出所有可行解一定是该环的因数 假环呢??(1->2->3->4,1->5->4),可行解便是两条路的差值的因数So??对于每条边,正建1,反建-1,dfs,每... 阅读全文
posted @ 2017-07-12 10:40 Ren_Ivan 阅读(72) 评论(0) 推荐(0) 编辑