摘要: 前言:今天被大作业的快速排序折磨的焦头烂额,原 C++ sort 选手发现简洁的快排竟然如此难写(边界要注意的点好多 qwq)。 我原先的快排长这样:题解 P1177 【【模板】快速排序】 - 沧海之耀 的博客 - 洛谷博客 (luogu.com.cn) 三路快排:快速排序 - OI Wiki (o 阅读全文
posted @ 2023-03-09 15:02 cjlworld 阅读(48) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:Tasks - AtCoder Beginner Contest 266 先贴代码,题解有空再补。 Tasks | | Task Name | Time Limit | Memory Limit | | | : : | : | : | : | : | | A | Middle Letter 阅读全文
posted @ 2023-02-02 20:28 cjlworld 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:[第 66 场周赛](竞赛 - AcWing) 先放代码,题解慢慢补 A AcWing 4606. 奇偶判断 #include<set> #include<map> #include<queue> #include<stack> #include<cmath> #include<ctime 阅读全文
posted @ 2022-08-28 07:43 cjlworld 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 比赛链接:第 60 场周赛 先放代码,题解慢慢补 A AcWing 4494. 吃饭 #include<set> #include<map> #include<queue> #include<stack> #include<cmath> #include<ctime> #include<bitset 阅读全文
posted @ 2022-07-16 21:04 cjlworld 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 参考资料 yyb blog Kewth blog 求解 $$x^2=n \pmod p$$ 仅介绍模数 p 为奇素数的解法,也就是 Cipolla 算法。 判定是否存在二次剩余 设 $n=g^a,x=g^b$,由于原根环的长度为 $p-1$ (是个偶数), 列出方程 $2b = a \pmod {p 阅读全文
posted @ 2022-07-05 15:54 cjlworld 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 使用 memset 和 memcpy,对于 long long 类型的数组, memset(a,0,n<<3) 可以清空前 $n$ 项,memcpy(A,a,n<<3) 可以 复制前 $n$ 项,比用 for 更快更简洁。 多项式乘法 | 快速傅里叶变换 fft blogs FFT什么的 updat 阅读全文
posted @ 2022-07-05 15:50 cjlworld 阅读(134) 评论(0) 推荐(1) 编辑
摘要: $${n \choose m}={n! \over (n-m)!m!}$$ 1 .定义法求组合数 Code LL C(LL a,LL b,LL MOD) { if(b>a) return 0; LL res=1; for(LL i=1,j=a;i<=b;i++,j--) { res=res*j%MO 阅读全文
posted @ 2022-07-05 15:49 cjlworld 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 探究不同进制的树上倍增 将以 $2$ 为底变成以 $x$ 为底。 那么每一位最多要跳 $x-1$ 次,扫描 $1$ 次。 跳一次时间复杂度 $\mathcal O(x\log_{x} n)。$ 代码,以 $16$ 进制为例。 预处理部分: for(i=1;i<=n;i++) up[i][0]=fa[ 阅读全文
posted @ 2022-07-05 15:47 cjlworld 阅读(33) 评论(0) 推荐(0) 编辑
摘要: 数论模板 快速幂 LL power(LL x,LL k,LL mod) { LL res=1; x%=mod; while(k) { if(k&1) res=res*x%mod; x=x*x%mod; k>>=1; } return res%mod; } 龟速乘 用快速加代替乘法。 在形如 $a=b 阅读全文
posted @ 2022-07-05 15:43 cjlworld 阅读(51) 评论(2) 推荐(0) 编辑
摘要: exCRT 处理 CRT 中 $a_i$ 不互质的情况。 一般使用 exCRT 毕竟其又好想又好写。 $$ x =b_1 \pmod {a_1} \ x =b_2 \pmod {a_2} \ \cdots \ x=b_n \pmod {a_n} $$ exCRT 的核心在于维护一个同余方程,并将同余 阅读全文
posted @ 2022-07-05 15:39 cjlworld 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 注意事项: unsigned Bignum. 减法必须保证 $a \ge b$. 暂时没有 高精 除 高精 没有压位,较慢。 我吐了,ntt 不支持压位。 代码: namespace Bignum { // # Bignum using vector as base // Done in 2021. 阅读全文
posted @ 2022-07-05 15:36 cjlworld 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 递推式 $f_1=f_2=1,f_i=f_{i-1}+f_{i-2} : (i \ge 3)$ 通项公式: $$f_{n}={{1\over \sqrt{5}}[({1+\sqrt{5} \over 2})^n-({1-\sqrt{5} \over 2})^n]}$$ 注意 ${1+\sqrt{5} 阅读全文
posted @ 2022-07-05 15:33 cjlworld 阅读(47) 评论(0) 推荐(0) 编辑
摘要: 比较全的 Linux 命令文档 : Linux 命令大全 英文全称对照 cd : change directory ls : list files mkdir : make directory cat : concatenate // concatenate,英语单词,作动词时译为“连接,连结,使连 阅读全文
posted @ 2022-06-30 13:43 cjlworld 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 比赛链接 第 56 场周赛 先放代码,题解慢慢补 A AcWing 4482. 分组 #include<bits/stdc++.h> using namespace std; const int N=105; int n; int a[N]; int main() { cin>>n; int ans 阅读全文
posted @ 2022-06-18 20:54 cjlworld 阅读(42) 评论(0) 推荐(0) 编辑
摘要: 日常被 ABC 虐 阅读全文
posted @ 2021-03-13 23:00 cjlworld 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 上分啦 hhh 阅读全文
posted @ 2021-03-13 22:48 cjlworld 阅读(376) 评论(0) 推荐(0) 编辑
摘要: 被 ABC 虐爆了 qwq 阅读全文
posted @ 2021-03-03 22:15 cjlworld 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #643 (Div. 2) Problems # Name A Sequence with Digits x17498 B Young Explorers x16642 C Count Triangles x7510 D Game With Array x12249 阅读全文
posted @ 2021-02-05 22:00 cjlworld 阅读(97) 评论(0) 推荐(0) 编辑
摘要: [ABC189] AtCoder Beginner Contest 189 Tasks Task Name Time Limit Memory Limit A Slot 2 sec 1024 MB Submit B Alcoholic 2 sec 1024 MB Submit C Mandarin 阅读全文
posted @ 2021-02-04 16:26 cjlworld 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Codeforces Round #698 (Div. 2) Problems # Name A Nezzar and Colorful Balls x14328 B Nezzar and Lucky Number x8969 C Nezzar and Symmetric Array x3415 D 阅读全文
posted @ 2021-01-29 09:46 cjlworld 阅读(415) 评论(1) 推荐(1) 编辑