摘要: 戳这里 斜率优化入门 先看一下题意 ​ 将n个任务在一台机器上分批加工,每批包含相邻若干任务,从0时刻开始,加工这些任务,其中第i个任务加工时间为 ti。在每批任务开始前,机器需要启动时间s,完成这批任务需要的时间是各个任务需要的时间和(同一批任务会在同一时刻完成)。每个任务的费用是他完成时刻乘一个 阅读全文
posted @ 2019-12-18 20:18 HexQwQ 阅读(254) 评论(1) 推荐(0) 编辑
摘要: #include <iostream> #include <string> #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #define range(i, a, b) for (int i = a 阅读全文
posted @ 2020-08-05 11:19 HexQwQ 阅读(106) 评论(1) 推荐(0) 编辑
摘要: 题意 给你一个长度为 \(n\) 的排列 \(P\) (初始化为 \(P = {1,2,...,n}\)) 和 \(m\) 次操作,每次操作是一对$(k,x)$表示对排列$P$ 进行 \(x\) 次 \(K- Josephus transform\)。 解析 发现对 \(P\) 进行一次 \(K- 阅读全文
posted @ 2020-07-30 16:46 HexQwQ 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 在 vs code 界面先输入 Ctrl + Shift + P 接着输入 configure user snippets 然后找到 c++ ,然后复制下面的代码,以后输入 prefix 里的东西再回车即可 { // Place your snippets for cpp here. Each sn 阅读全文
posted @ 2020-07-29 09:38 HexQwQ 阅读(334) 评论(2) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pii; const int Maxn = 2e5+10; const int Inf = 0x7f7f7f7f; co 阅读全文
posted @ 2020-07-22 22:17 HexQwQ 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 题意 给你 \(m\) 种花,在收到第 \(i\) 种类型的花后,幸福度会增加 \(a_i\),在收到每一朵连续的这种类型的花后,幸福度会增加 \(b_i\) ,也就是说如果收到 \(x_i\) 种类型为 \(i\) 的花,幸福度就会增加 \(a_i + (x_i-1)*b_i\) ,现在你可以得到 阅读全文
posted @ 2020-07-19 23:03 HexQwQ 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题意 给出两个序列 A、B,其长度分别为 n、m,保证 $n>m $ ,求 A 中有多少个长度为 m 的子串 S,使得$\forall i\in{1,2,\cdots,m},S_i \ge B_i$ 解析 出题人直播时表示看到数据很容易想到用 \(bitset\) (雾 对于每一个 \(A_i\) 阅读全文
posted @ 2020-07-13 22:39 HexQwQ 阅读(380) 评论(3) 推荐(3) 编辑
摘要: 题意 给出一个 \(n*m\) 的地板,每一行会被分为多个隔间,每个隔间只能有一个 1 ,其余都是 0 。我们定义地板的质量为每列值的和的平方和。 解析 首先 \(n,m\) 都比较小,我们可以用区间dp 。 根据区间dp 的常见形式,可以写出其状态转移方程 \(dp[i][j] = max(dp[ 阅读全文
posted @ 2020-07-12 22:14 HexQwQ 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 题意 给你一个长度为 n 的数组(保证 n 为奇数),数组头尾相连变成一个环。现在你需要对这个环进行多次如下操作直到数组中只剩下一个数,使得最后这个数最大。 操作方法:选择数组中的一个数,将其替换为相邻左右两数的合,并且删除掉左右两边的数。 也就是说跟原数组相比,x 位置上的数变成 \(x-1\) 阅读全文
posted @ 2020-07-12 22:12 HexQwQ 阅读(172) 评论(3) 推荐(4) 编辑
摘要: ```c++ #include using namespace std; typedef long long ll; const int Maxn = 1e5+10; const int Inf = 0x7f7f7f7f; const int Mod = 1e9+7; int a[Maxn],v[Maxn]; int l_0[Maxn],r_1[Maxn]; double ans[Maxn]; i 阅读全文
posted @ 2020-05-23 17:03 HexQwQ 阅读(127) 评论(0) 推荐(0) 编辑
摘要: ```c++ #include using namespace std; typedef long long ll; const int Maxn = 1e6+10; const int Inf = 0x7f7f7f7f; const int Mod = 998244353; int n,m; char s[12000010]; priority_queue ,greater > Map[Maxn 阅读全文
posted @ 2020-05-23 17:02 HexQwQ 阅读(118) 评论(0) 推荐(0) 编辑