摘要: A 题解 rmq 代码 #include <bits/stdc++.h> #define all(n) (n).begin(), (n).end() #define se second #define fi first #define pb push_back #define mp make_pai 阅读全文
posted @ 2020-04-30 13:44 洛绫璃 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 思路 题意不就不说了,刚开始用trie妥妥超时(后来看标程, 发现是trie + dp) 我然后又看到长度小于2e5,想后 缀数组的rmq(主要是学rmq部分) , 结果死在了求heigh数组, 毕竟heigh,你往后延伸不能从一个字符串跨到另一个字符串 折磨了半天, 突然想到heigh是求每个位置 阅读全文
posted @ 2020-04-30 13:30 洛绫璃 阅读(212) 评论(0) 推荐(0) 编辑
摘要: 题目描述 某人读论文,一篇论文是由许多单词组成。但他发现一个单词会在论文中出现很多次,现在想知道每个单词分别在论文中出现多少次。 输入描述: 第一个一个整数N,表示有多少个单词,接下来N行每行一个单词。每个单词由小写字母组成,N ≤ 200,单词长度不超过10^6 输出描述: 输出N个整数,第i行的 阅读全文
posted @ 2020-04-13 17:25 洛绫璃 阅读(225) 评论(0) 推荐(0) 编辑
摘要: B(DP) 最重要的是状态转移对同一阶段的影响, 就像01背包优化为什么要倒叙,但这道题不光要倒叙,还要把这阶段的转移先存起来,最后统一保存 就避免了转移同一阶段相互影响 至于排序,当然希望升级多余的经验越多越好。 #include <bits/stdc++.h> #define RE regist 阅读全文
posted @ 2020-04-12 21:41 洛绫璃 阅读(224) 评论(0) 推荐(0) 编辑
摘要: E (尺取法) #include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 2e5 + 5; int n; char s[maxn]; int main() { cin >> s + 1 >> 阅读全文
posted @ 2020-04-09 22:40 洛绫璃 阅读(185) 评论(0) 推荐(0) 编辑
摘要: A #include <bits/stdc++.h> using namespace std; int a, b , n, c; int main() { cin >> a >> b >> n; for (int i = 1; i <= n; ++i) { cin >> c; cout << c < 阅读全文
posted @ 2020-04-07 00:49 洛绫璃 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 直接倒着放,然后在正着平移,使得铺满n #include <bits/stdc++.h> #define ll long long using namespace std; const int maxn = 1e5 + 5; int t, n, m, a[maxn], b[maxn]; int ma 阅读全文
posted @ 2020-04-06 01:02 洛绫璃 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 这道题容斥想了半天。。。 拉丁字母共 52个 2^52 = 4e15, 不会爆long long,于是先给字母编号 inline int calc(char c) { if (c < 'a') return c - 'A'; return (c - 'a' + 26); } 这样对于当前状态 ll 阅读全文
posted @ 2020-04-05 13:28 洛绫璃 阅读(149) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> #define ll long long using namespace std; int n, mod = 1000000007; char s[200005]; int main() { cin >> n >> s + 1; ll ans = 0 阅读全文
posted @ 2020-04-05 12:16 洛绫璃 阅读(137) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; int n; set <int> a; map <int,int> cnt; int main() { cin >> n; int ans = 0; for (int i = 1; i <= n; ++i) 阅读全文
posted @ 2020-04-05 12:08 洛绫璃 阅读(172) 评论(0) 推荐(0) 编辑