2022年1月15日
摘要: 题目链接: https://codeforces.com/problemset/problem/1625/C 题目大意: 在一条长为 \(l\) 的公路上有 \(n\) 个路标,第 \(i\) 个路标在第 \(d_i\) 米处,限速 \(a_i\),意味着在这个路标到下一个路标之间的路段最快速度是 阅读全文
posted @ 2022-01-15 22:34 Hamine 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://codeforces.com/problemset/problem/1622/D 题目大意: 给定一个只含01的字符串,你可以选择其中一个包含 \(k\) 个 1 的子串,然后对这个子串重新排序,计算可以获得多少个不同的字符串。 思路: 因为符合条件的子串有可能有很多个, 阅读全文
posted @ 2022-01-15 17:26 Hamine 阅读(253) 评论(0) 推荐(0) 编辑
  2022年1月14日
摘要: 题目链接: https://codeforces.com/problemset/problem/1624/D 题目大意: 长为 \(n\) 的字符串,有 \(k\) 种颜色,对字符串进行染色,每种颜色都要出现,但不用每个字符都染色。同一种颜色的字符构成要构成一个回文字符串,求能获得的回文子串中最短的 阅读全文
posted @ 2022-01-14 18:57 Hamine 阅读(239) 评论(1) 推荐(1) 编辑
  2022年1月13日
摘要: 1.快速排序 #include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int a[N], n; void quickSort(int l, int r){ int key = a[(l + r) / 2], i = 阅读全文
posted @ 2022-01-13 23:01 Hamine 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://codeforces.com/problemset/problem/1591/D 题目大意: 给定一个长度为 \(n\) 的序列,可以选择其中的一个三元组 \((i, j, k)\),按顺序移动 \(i -> j -> k -> i\),可以进行任意次该操作,判断是否能使 阅读全文
posted @ 2022-01-13 23:00 Hamine 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 题目链接: https://www.luogu.com.cn/problem/P1908 题目大意: 给长为 n 的序列,求序列中逆序对的数目 思路: 一、 归并: #include <bits/stdc++.h> using namespace std; #define LL long long 阅读全文
posted @ 2022-01-13 16:31 Hamine 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 单点修改,区间查询 #include <bits/stdc++.h> using namespace std; using LL = long long; struct Fenwick{ int n; vector<int> a; Fenwick(int n) : n(n), a(n + 1) {} 阅读全文
posted @ 2022-01-13 12:18 Hamine 阅读(68) 评论(0) 推荐(0) 编辑
  2022年1月11日
摘要: 题目链接: https://codeforces.com/problemset/problem/1266/E 题目大意: 在游戏中要造宇宙飞船,需要 \(n\) 种材料,第 \(i\) 种材料需要 \(a_i\) 个。游戏更新了 \(q\) 个回合,每个回合会出现一个新的里程碑 (s, t, u), 阅读全文
posted @ 2022-01-11 15:31 Hamine 阅读(49) 评论(0) 推荐(0) 编辑
  2022年1月10日
摘要: 题目链接: https://codeforces.com/problemset/problem/1266/D 题目大意: 有 \(n\) 个人,有 \(m\) 条债务关系,定义 \(d(a, b)\) 表示 \(a\) 欠 \(b\) 块钱,如果 \(c\) = 0,那么就相当于没有债务关系,现在想 阅读全文
posted @ 2022-01-10 21:53 Hamine 阅读(55) 评论(2) 推荐(1) 编辑
  2022年1月7日
摘要: head 记录了从每个节点出发的第一条边在 ver 和 edge 数组中的储存位置 ver 记录了每条边的终点 edge 记录每条边的边权 next 模拟了链表指针 //存图 void add(int x, int y, int z){ //x:起点 y:终点 z:权值 ver[++tot] = y 阅读全文
posted @ 2022-01-07 16:47 Hamine 阅读(46) 评论(0) 推荐(0) 编辑