摘要: 带权并查集 #include <bits/stdc++.h> #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define LL long long using namespace st 阅读全文
posted @ 2022-02-28 23:31 Angels_of_Death 阅读(36) 评论(0) 推荐(0)
摘要: 题目等价于计算$M^{k^{N}} \ mod \ P$ 由费马小定理$M^{p-1} \equiv 1(mod \ P)$ 原式等于$M^{q(p-1)+r} mod \ P$其中$r=K^N mod(P-1)$ #include <bits/stdc++.h> #define IOS ios:: 阅读全文
posted @ 2022-02-28 23:03 Angels_of_Death 阅读(31) 评论(0) 推荐(0)
摘要: 并查集 $p[i]$表示当前要插入的位置第一个可用位置 $a[i]$表示当前位置的值 #include <bits/stdc++.h> #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #d 阅读全文
posted @ 2022-02-28 22:58 Angels_of_Death 阅读(28) 评论(0) 推荐(0)