图
shishiness
这个作者很懒,什么都没留下…
展开
-
2020年7月 pat 甲级 第三题
题意:给出各个动物园之间的相连情况,要求每两个相连动物园的动物种类不同 。总共有K种动物,n个动物园,r条路径信息。#include<iostream>#include<set>#include<vector>using namespace std;struct Node{ int animal; vector<int> nei;}node[10000];int n,r,k;int main(){ cin>>n>&g原创 2020-07-26 10:01:07 · 164 阅读 · 0 评论 -
pat 甲级 图 A1013 Battle Over Cities (25分) dfs
1013 Battle Over Cities (25分)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we need to repair any other hig原创 2020-08-24 09:12:44 · 50 阅读 · 0 评论 -
pat 甲级 图 A1146 Topological Order (25分)有向图 拓扑序列
1146 Topological Order (25分)This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supposed to write a program to test each of the options.I原创 2020-07-25 10:45:35 · 91 阅读 · 0 评论 -
pat 甲级 图 A1150 Travelling Salesman Problem (25分)
The "travelling salesman problem" asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest possible route that visits each city and returns to the origin city?" It is an NP-hard problem in com原创 2020-07-25 10:54:44 · 82 阅读 · 0 评论 -
pat 甲级 图 A1142 Maximal Clique (25分)团
1142 Maximal Clique (25分)A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more adjacent vertex. (Quoted from ht原创 2020-08-23 20:16:37 · 65 阅读 · 0 评论 -
pat 甲级 图 A1126 Eulerian Path (25分)欧拉图判别
1126 Eulerian Path (25分)In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which starts and ends on the same vertex. They were first discussed by Leonhard Euler原创 2020-08-23 20:16:24 · 77 阅读 · 0 评论 -
pat 甲级 图 A1122 Hamiltonian Cycle (25分)简单
1122 Hamiltonian Cycle (25分)The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle".In this problem, you are supposed to tell if a given cycle is a Hamiltonian cycle.I原创 2020-08-23 20:16:10 · 229 阅读 · 1 评论 -
pat 甲级 图 A1134 Vertex Cover (25分)
1134 Vertex Cover (25分)A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set. Now given a graph with several vertex sets, you are supposed to tell if each of them is a vertex cover o原创 2020-08-23 20:15:52 · 80 阅读 · 0 评论 -
pat 甲级 图的遍历 A1034 Head of a Gang (30分)
1034 Head of a Gang (30分)One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be the total time length of all t原创 2020-07-25 10:58:39 · 64 阅读 · 0 评论 -
pat 甲级 图的遍历 连通分量个数 dfs A1021 Deepest Root (25分)
1021 Deepest Root (25分)A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is called the deepest root.In原创 2020-07-19 12:29:13 · 133 阅读 · 0 评论