02 2022 档案
摘要:1122 1122 点击查看代码 #include <bits/stdc++.h> using namespace std; int n,m; int G[210][210]; int main() { #ifdef ONLINE_JUDGE #else freopen("1.txt", "r",
阅读全文
摘要:The “travelling salesman problem” asks the following question: “Given a list of cities and the distances between each pair of cities, what is the shor
阅读全文
摘要: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
阅读全文
摘要: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 pr
阅读全文
摘要:1013 1013 点击查看代码 #include <bits/stdc++.h> using namespace std; vector<int> G[10010]; bool vis[10010]; int curpoint; void dfs(int index) { if(index==cu
阅读全文
摘要:1086 1086 发现一个问题,如果vector事先resize了的话,再用push_back()添加元素就会失败,这种情况应该像数组那样处理。All in all,要么不resize然后push_back();要么resize用下标添加。 点击查看代码 #include <bits/stdc++
阅读全文
摘要:Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino
阅读全文
摘要:The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants. Given any two nodes in a bin
阅读全文
摘要:Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to out
阅读全文
摘要:1004 1004 #include <bits/stdc++.h> using namespace std; vector<int> G[101]; int leaf[101]; int maxh; void DFS(int root,int h) { maxh=max(maxh,h); if(G
阅读全文
摘要:1124 Raffle for Weibo Followers (20 分)(map) John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Wei
阅读全文
摘要:Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gainin
阅读全文
摘要:A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as po
阅读全文
摘要:A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a progra
阅读全文
摘要:There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any s
阅读全文
摘要:As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some ro
阅读全文
摘要: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
阅读全文
摘要: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 c
阅读全文
摘要:Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social n
阅读全文
摘要: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 re
阅读全文
摘要:According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert
阅读全文

浙公网安备 33010602011771号