摘要:
这里带来一手整数的二分模板。 bool check(int x) {/* ... */} // 检查x是否满足某种性质 // 区间[l, r]被划分成[l, mid]和[mid + 1, r]时使用: int bsearch_1(int l, int r) { while (l < r) { int 阅读全文
摘要:
归并排序其实也是分治的思想 首先归并排序跟快排一样同样需要考虑分界点 归并排序的分界点都是取中间值 其次归并排序需要递归排序左边和右边 最后一部也是最难的一部需要将分开的归并排序合二为一 #include<iostream> using namespace std; int n; const int 阅读全文