摘要: 一般图匹配带花树 1 #include <bits/stdc++.h> 2 3 using namespace std; 4 const int maxm=50100; 5 const int maxn=500; 6 char ch[200]; 7 int t,to[maxm],head[maxn] 阅读全文
posted @ 2019-08-26 11:55 Snow_in_winer 阅读(206) 评论(0) 推荐(0) 编辑
摘要: 题目描述 飞飞国是一个传说中的国度,国家的居民叫做飞飞侠。飞飞国是一个N×M 的矩形方阵,每个格子代表一个街区。 然而飞飞国是没有交通工具的。飞飞侠完全靠地面的弹射装置来移动。 每个街区都装有弹射装置。使用弹射装置是需要支付一定费用的。而且每个弹射装置都有自己的弹射能力。 我们设第 i 行第 j 列 阅读全文
posted @ 2020-06-28 12:12 Snow_in_winer 阅读(654) 评论(0) 推荐(0) 编辑
摘要: ###题目描述 N个虫洞,M条单向跃迁路径。从一个虫洞沿跃迁路径到另一个虫洞需要消耗一定量的燃料和1单位时间。虫洞有白洞和黑洞之分。设一条跃迁路径两端的虫洞质量差为delta。 1.从白洞跃迁到黑洞,消耗的燃料值减少delta,若该条路径消耗的燃料值变为负数的话,取为0。 2.从黑洞跃迁到白洞,消耗 阅读全文
posted @ 2020-06-27 19:37 Snow_in_winer 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 如题,给出一个无向图,求出最小生成树,如果该图不连通,则输出 orz。 ###输入格式 第一行包含两个整数 N,M,表示该图共有 N 个结点和 M 条无向边。 接下来 M行每行包含三个整数 X_i,Y_i,Z_i,表示有一条长度为 Z_i的无向边连接结点 X_i,Y_i ###输出格式 如果该图连通 阅读全文
posted @ 2020-06-27 13:22 Snow_in_winer 阅读(133) 评论(0) 推荐(0) 编辑
摘要: 本题链接 ##从叶子(尚未访问过的节点)往上找其最远的祖先,若能找到根,则合题;若找到环或找到与树不连通的祖先,则将祖先的父亲指向根。 #include <bits/stdc++.h> namespace FastIO { char buf[1 << 21], buf2[1 << 21], a[20 阅读全文
posted @ 2020-06-27 09:49 Snow_in_winer 阅读(221) 评论(0) 推荐(0) 编辑
摘要: ###题目描述 小明要去一个国家旅游。这个国家有N个城市,编号为1至N,并且有M条道路连接着,小明准备从其中一个城市出发,并只往东走到城市i停止。 所以他就需要选择最先到达的城市,并制定一条路线以城市i为终点,使得线路上除了第一个城市,每个城市都在路线前一个城市东面,并且满足这个前提下还希望游览的城 阅读全文
posted @ 2020-06-27 08:50 Snow_in_winer 阅读(182) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; int n,a[1000],b[1000]; void QuickSort(int a[],int l,int r) { if (l < r) { int x = a[l], i = l, j = r; wh 阅读全文
posted @ 2020-06-10 17:46 Snow_in_winer 阅读(167) 评论(0) 推荐(0) 编辑
摘要: ###归并排序 void merge_sort(int l,int r) { if (l == r) { return; } int mid = l + r >> 1; merge_sort(l, mid); merge_sort(mid + 1, r); int i = l, j = mid + 阅读全文
posted @ 2020-06-10 17:02 Snow_in_winer 阅读(128) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace std; typedef int ElemType; class SeqQueue { //顺序栈类定义 protected: int rear, f 阅读全文
posted @ 2020-06-10 16:27 Snow_in_winer 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 假设无向、非加权图的数据元素为字符,采用邻接表存储结构。图的创建、存储结构输出等大部分操作的实现代码操作已经给出,请分别补充写出操作插入边、删除边的实现函数代码。 有关说明: (1)插入边, int Insert_Edge(g,vi,vj) 输入:图g,要插入边的两个顶点元素vi,vj; 输出:返回 阅读全文
posted @ 2020-06-10 16:25 Snow_in_winer 阅读(218) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; const int maxn=1e6+10; void get_next(char x[],int n,int nxt[]) { int i = 0, j = nxt[0] = -1; while (i < 阅读全文
posted @ 2020-06-10 16:22 Snow_in_winer 阅读(166) 评论(0) 推荐(0) 编辑