摘要:
#include <iostream> using namespace std; const int MAXN = 1e4 + 10; int arr[MAXN]; int N, M; void init(int N) //初始化根节点为自己 { for(int i = 1; i <= N; i++ 阅读全文
摘要:
qpow 快速幂 #include <iostream> using namespace std; typedef long long ll; ll N, M, MOD; ll qpow(ll a, ll b) { ll ans = 1; a %= MOD; //预处理 while(b) { if( 阅读全文
摘要:
1.快速排序 #include <iostream> using namespace std; const int MAXN = 2e5 + 10; int arr[MAXN]; int len; void qsort(int arr[], int fst, int lst) { int i = f 阅读全文
摘要:
“年轻人切忌旋入技术细节漩涡, 那是无底之洞” ----Zeo 基础BFS加一堆字符串处理细节逐个比较是否可替换替换时把字符拆成三段 前 要替换的 后根据string 特性前 + 替换的... 阅读全文
摘要:
水题#include #include using namespace std;const int MAXN = 1e5;int arr[MAXN];int ans = 0;int N, M;bool find(... 阅读全文
摘要:
网上都是二分搜索答案其实过程也可以二分搜索洛谷有个扔瓶盖一样的#include #include using namespace std;const int MAXN = 1e5 + 50;int cow[MA... 阅读全文
摘要:
按左点排序能干就干 干不了加人但这次数据非常大 手动模拟超时需要用到优先队列 或 mutilset队列能解决的set 都可以解决set支持性更佳 所以个人更倾向于set#include #include #inc... 阅读全文
摘要:
bfs 有稳定向下搜索(距离恒定)的特性常用来求最优解(首解必定最优)用队列维护搜索可保持其顺序特性bfs的过程比dfs容易理解的多在此不做记录该题单bfs可以过七个点三个tle需要优化仔细推一遍可以发现每次求得... 阅读全文