Loading

上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页
摘要: Luogu-CF1365A 题目分析 如果当前玩家想要在网格图上找一个位置设置为 \(1\),条件式这一个位置所在的行以及列上都没有其它的 \(1\)。 观察到数据范围只有 $1 \leq n,m \leq 50 $,我们可以考虑直接在网格图上操作。 在读入的时候,只要读入到当前位置的数为 \(1\ 阅读全文
posted @ 2021-06-29 10:22 EdisonBa 阅读(60) 评论(0) 推荐(0) 编辑
摘要: 求单源 \(s\) 到任意一点的最短路径。最短路径保存在数组 dis 中。 链式前向星 #include <queue> priority_queue<pair<ll, ll>> q; void dijkstra(int s) { memset(dis, 0x3f, sizeof(dis)); // 阅读全文
posted @ 2021-06-29 10:20 EdisonBa 阅读(16) 评论(0) 推荐(0) 编辑
摘要: vector 存图 struct node{ ll to, w; }; vector<node> t[maxn]; void add(const int u, const int v, const int w) { t[u].push_back((node){v, w}); } 链式前向星存图 如果 阅读全文
posted @ 2021-06-29 10:18 EdisonBa 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 01背包 最大价值 背包数量为 \(V\),有 $n$件物品,重量为 \(w_i\),价值为 \(c_i\)。求能获得最大价值。 ll V, n, w[10000], c[10000], f[10000]; int main() { V = read(); n = read(); for (int 阅读全文
posted @ 2021-06-29 10:15 EdisonBa 阅读(36) 评论(0) 推荐(0) 编辑
摘要: LCS 操作对象:两个长度不一定相等的字符串。 例题 string s, t; int f[maxn][maxn]; int main() { cin >> s >> t; int ls = s.length(), lt = t.length(); for (int i = 1; i <= ls; 阅读全文
posted @ 2021-06-29 10:13 EdisonBa 阅读(33) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 15 下一页