摘要: 1001:HDU6397 Character Encoding 公式题,可以用容斥和隔板法推出来。 #include <iostream> #include <cstdio> #include <cstdlib> using namespace std; const int MAX=3e5+5; c 阅读全文
posted @ 2018-08-19 20:38 Hetui 阅读(304) 评论(0) 推荐(0) 编辑
摘要: A: Circulant Matrix 已知序列a和x的fwt结果是b,知道a和b求x。 其实就是FWT的逆过程。先对b做ufwt,对a做fwt,然后x就是b/a。之后对得到的x做一遍fwt即可。 #include <cstdio> #include <cstdlib> #include <iost 阅读全文
posted @ 2018-08-19 20:30 Hetui 阅读(489) 评论(0) 推荐(0) 编辑
摘要: 1001:Age of Moyu 在SPFA的时候开一个set或map记录一下转移到他的边的种类,转移的时候尽量选和当前这条边种类一样的边转移,玄学复杂度,记得fread读入挂和register进行常数优化。 1 #include<bits/stdc++.h> 2 3 #define maxn 10 阅读全文
posted @ 2018-08-14 19:53 Hetui 阅读(324) 评论(0) 推荐(0) 编辑
摘要: A:Singing Contest 模拟题,在胜者树上模拟即可,最优策略很容易,要赢的人选比对方最大的数还要大的而且尽量小的歌就行 #include<bits/stdc++.h> #define maxn 15 using namespace std; set <int> s[1<<maxn]; i 阅读全文
posted @ 2018-08-05 10:16 Hetui 阅读(137) 评论(0) 推荐(0) 编辑
摘要: A:gpa 分数规划裸题了吧,然后二分次数过多的话会超时 #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; const int MAX=1e5+5; int n, 阅读全文
posted @ 2018-08-05 09:41 Hetui 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1001:Problem A. Integers Exhibition 重要结论:一个数如果是k-magic数,那么它的倍数也是k-magic数。 发现非k-magic数很少 一开始知道1是非k-magic数。从小到大枚举质数。 对于每个质数p,将已知的数乘以p的幂加入数列直到超出上限,然后筛掉全部 阅读全文
posted @ 2018-08-05 09:36 Hetui 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1001:Problem A. Ascending Rating 首先可以通过单调栈维护出每个位置右边第一个大于自己的数所在的位置,记为rightmax[i],然后维护一个双端队列。双端队列里维护[L,L+m-1]中的最长上升子序列,首先队首很好维护,只要判断当前head的 rightmax[]是不 阅读全文
posted @ 2018-07-31 19:46 Hetui 阅读(213) 评论(0) 推荐(0) 编辑
摘要: A:Ternary String 扩展欧拉降幂,维护不同模phi下的ans,观察可得后面一堆phi是2的指数,当指数很大时取模都是1,所以只要维护8层phi就好了 B:Interval Revisited ⼀一个显然的结论:每个位置最多被两个区间覆盖 •所有区间按照右端点从小到大排序 •dp(i, 阅读全文
posted @ 2018-07-31 19:38 Hetui 阅读(523) 评论(3) 推荐(0) 编辑
摘要: A:PACM Team 四维的01背包,注意一下所有代价都是0时的方案输出即可 #include<queue> #include<cstdio> #include<cstdlib> #include<cstring> #include<algorithm> #define maxn 37 using 阅读全文
posted @ 2018-07-26 20:51 Hetui 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 1003:Cover 巧妙的构造,先找出所有奇数点,再成对连边,在新图里面跑欧拉回路(dfs边到底),切开之前连的边就是划分方案,这样能得到答案是max(d/2,1) (d为奇数点的个数) 1 #include<cmath> 2 #include<queue> 3 #include<cctype> 阅读全文
posted @ 2018-07-26 20:45 Hetui 阅读(183) 评论(0) 推荐(0) 编辑