摘要: [题目链接](https://codeforces.com/gym/104385 "题目链接") *** ###B 对于 $n$ 对关系 , 反过来考虑 $b_{i} > b{i + 1}$的个数 观察 $bn$ 的形式 : $x ,\ x + a_{0} ,\ x + a_{0} + a_{1} 阅读全文
posted @ 2023-07-09 20:50 xqy2003 阅读(27) 评论(0) 推荐(0)
摘要: [题目链接](https://codeforces.com/gym/104090 "题目链接") *** ###A 问题等价于求 $ans = (\sum_{i = 1}^{n}a_{i} + n * s + \frac{n(n+1)}{2}* d ) \ \% \ m$ 的最小值 记 $\sum_ 阅读全文
posted @ 2023-07-09 19:58 xqy2003 阅读(166) 评论(0) 推荐(0)
摘要: 题目链接 c 考虑到 \(x\) 为 \(1\) , 我们可以枚举 \(y\) 减了多少次 , 那么根据同余方程 $ sum + i * y + j * x \equiv 0 \space (mod \ n)$ , 注意 \(y\) 次数 (\(i\))枚举范围就是 \([0 , n - 1]\) 阅读全文
posted @ 2023-07-09 19:14 xqy2003 阅读(23) 评论(0) 推荐(0)
摘要: [题目链接](https://codeforces.com/contest/1822 "题目链接") *** ###G2 考虑按值域分治 将 $x$ 当作中间的数 如果 $x \leq 10^6$ , 直接根号复杂度枚举其因子即可 如果 $x > 10^6$ , 注意到一个数的上限是 $10^9$ 阅读全文
posted @ 2023-07-08 17:25 xqy2003 阅读(32) 评论(0) 推荐(0)
摘要: [题目链接](https://codeforces.com/contest/1846 "题目链接") *** ###E2 按值域分治的技巧 前置 : $f(k , n) = 1 + k + k ^ 2 + ... + k ^ n$ $①$ : 假设答案最终的 $n = 2$ , 对于 $1 + k 阅读全文
posted @ 2023-07-08 17:08 xqy2003 阅读(25) 评论(0) 推荐(0)
摘要: [题面](https://oj.saikr.com/contest/problem/14 "题面") *** ###Best Travel Plans 枚举在哪个城市停止旅行 , 这样我们在路程上花费的时间就确定了 , 同时确定了在活动上花费的时间 对于活动花费的时间,我们贪心选择每一秒的最优值即可 阅读全文
posted @ 2023-07-03 12:55 xqy2003 阅读(130) 评论(1) 推荐(0)
摘要: ###基本形式 ![image](https://img2023.cnblogs.com/blog/2509625/202307/2509625-20230701140951565-879314415.png) ``` 例子 : int a = 1 ; auto f = [&](int x,int 阅读全文
posted @ 2023-07-01 14:17 xqy2003 阅读(103) 评论(0) 推荐(1)
摘要: 题目链接 A 二分图染色 , 重点是构造二分图的部分 #include <bits/stdc++.h> using namespace std; #define ll long long const int N = 1E5 + 5; int n; int head[N * 2],ver[N * 4] 阅读全文
posted @ 2023-06-30 10:56 xqy2003 阅读(23) 评论(0) 推荐(0)
摘要: ``` #include using namespace std; const int K = 20; const int N = 5E5 + 5 , M = N * 2; int head[N],ver[M],nxt[M],tot; int dep[N],bz[N][K]; void add(in 阅读全文
posted @ 2023-06-30 09:38 xqy2003 阅读(15) 评论(0) 推荐(0)
摘要: *** ###一般随机化 ``` srand(time(0)); x = rand(); [a , b) : x = rand() % (b - a) + a; [a , b] : x = rand() % (b - a + 1) + a; (a , b] : x = rand() % (b - a 阅读全文
posted @ 2023-05-30 15:42 xqy2003 阅读(26) 评论(0) 推荐(0)