Key Vertex Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1347 Accepted Submission(s): 305 Problem Description You need walking from vertex S to vertex T in a graph. If you remove one vert…
Find a way Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9698 Accepted Submission(s): 3165 Problem Description Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally…
http://acm.hdu.edu.cn/showproblem.php?pid=2066 一个人的旅行 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 36107 Accepted Submission(s): 12313 Problem Description 虽然草儿是个路痴(就是在杭电待了一年多,居然还会在校园里迷路的人,…
Solution 注意取模!!! Code #include<bits/stdc++.h> #define mod 1000000007 #define LL long long using namespace std; int n, a, b; LL mpow(LL a, LL b) { LL ans = ; , a = a * a % mod) ) ans = ans * a % mod; return ans; } LL fac[], inv[], l[], t[]; void init…
最开始想的暴力DP是把天数作为一个维度所以怎么都没有办法优化,矩阵快速幂也是$O(n^3)$会爆炸. 但是没有想到另一个转移方程:定义$f[i][j]$表示每天都有值的$i$天,共消费出总值$j$的方案数.然后答案就是. 所以每次维护前缀和就可以$O(1)$转移了. 注意前缀和的初值. #include<bits/stdc++.h> #define LL long long #define mod 998244353 using namespace std; int n, m; LL d; L…