摘要: 二分图匹配。 补充,感觉之前说的不够详细,如果有完美匹配的话,每行都有一个对应的列,那么换来换去以后,对角线就全黑了。。。 #include #include #include using namespace std; const int maxn = 400 + 10; bool vis[maxn]; int p[maxn],map[maxn][maxn]; int n,T; ... 阅读全文
posted @ 2016-05-25 19:30 invoid 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 斜率优化。 大水题。。。 #include #include #include using namespace std; const int maxn = 1000000 + 10; int q[maxn],l,r; long long f[maxn],s[maxn],a,b,c,x; int n,m; inline long long sqr(long long x) { ... 阅读全文
posted @ 2016-05-25 18:01 invoid 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 不知道什么算法。 首先求一颗植物(i,j)与能量采集器的连线上有几颗植物。 答案是(gcd(i,j)-1),设i’= i/gcd(i,j),j’=j/gcd(i,j). 则这几颗植物是(i’k,j’k) 1 #include #include using namespace std; const int maxn = 100000 + 10; long long ans[maxn],... 阅读全文
posted @ 2016-05-25 17:11 invoid 阅读(111) 评论(0) 推荐(0) 编辑
摘要: 矩阵乘法. 10^k,0,0 (f[i+1],i+1,1) = (f[i],i,1) ( 1, 1,0 ) 1. 1,0) k为(i+1)的位数。这点很重要,所以每回都是算到999…9,然后k就会+1。所以题目中的l和... 阅读全文
posted @ 2016-05-25 10:20 invoid 阅读(127) 评论(0) 推荐(0) 编辑