
图的遍历
文章平均质量分 82
dxyinme
这个作者很懒,什么都没留下…
展开
-
[洛谷OJ] [USACO06DEC]牛的野餐Cow Picnic
题目描述The cows are having a picnic! Each of Farmer John’s K (1 ≤ K ≤ 100) cows is grazing in one of N (1 ≤ N ≤ 1,000) pastures, conveniently numbered 1…N. The pastures are connected by M (1 ≤ M ≤ 10,000)原创 2017-07-01 23:32:18 · 490 阅读 · 0 评论 -
[codeforces917B]MADMAX
time limit per test : 1 secondmemory limit per test : 256 megabytesAs we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actu...原创 2019-07-10 10:39:32 · 416 阅读 · 0 评论 -
[codeforces920E]Connected Components?
time limit per test : 2 secondsmemory limit per test : 256 megabytes分数:2100You are given an undirected graph consisting of nnn vertices and edges. Instead of giving you the edges that exist in the ...原创 2019-07-23 20:46:38 · 190 阅读 · 0 评论 -
[codeforces 508D]Tanya and Password
time limit per test : 2 secondsmemory limit per test : 256 megabytesWhile dad was at work, a little girl Tanya decided to play with dad’s password to his secret database. Dad’s password is a string ...原创 2019-07-17 14:24:32 · 299 阅读 · 0 评论 -
[codeforces796D]Police Stations
time limit per test : 2 secondsmemory limit per test : 256 megabytes分数:2100Inzane finally found Zane with a lot of money to spare, so they together decided to establish a country of their own.Ruli...原创 2019-08-02 16:13:58 · 225 阅读 · 0 评论 -
[codeforces 1141G]Privatization of Roads in Treeland
time limit per test : 2 secondsmemory limit per test : 256 megabytes分数:2500Treeland consists of nnn cities and n−1n−1n−1 roads. Each road is bidirectional and connects two distinct cities. From any...原创 2019-07-22 19:51:05 · 183 阅读 · 0 评论 -
[codeforces19E]Fairy
time limit per test : 1.5 secondsmemory limit per test : 256 megabytes分数:2800Once upon a time there lived a good fairy A. One day a fine young man B came to her and asked to predict his future. The...原创 2019-08-02 13:12:14 · 520 阅读 · 0 评论 -
[hdu6567]Cotree
Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others)分数:2500Problem DescriptionAvin has two trees which are not connected. He asks you to add an edge between them to ma...原创 2019-08-11 10:52:14 · 215 阅读 · 0 评论 -
[codeforces1217D]Coloring Edges
time limit per test : 1 secondmemory limit per test : 256 megabytes分数:2000You are given a directed graph with nnn vertices and mmm directed edges without self-loops or multiple edges.Let’s denote ...原创 2019-09-08 00:37:55 · 314 阅读 · 0 评论 -
[HDU3887]Counting Offspring
Time Limit: 15000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Problem DescriptionYou are given a tree, it’s root is ppp, and the node is numbered from 111 to nnn. Now define f(i)f...原创 2019-03-09 15:08:29 · 164 阅读 · 0 评论 -
[HDU3899]JLUCPC
Time Limit: 15000/5000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Problem DescriptionDr. Skywind and Dr. Walkoncloud are planning to hold the annual JLU Collegiate Programming Contest...原创 2019-03-03 22:07:56 · 256 阅读 · 1 评论 -
[VIJOS1129]产生数
背景给出一个整数 nnn(nnn<10^30) 和 kkk 个变换规则(kkk<=15)。规则: 一位数可变换成另一个一位数: 规则的右部不能为零。例如:nnn=234。有规则(kkk=2): 2-> 5 3-> 6 上面的整数 234 经过变换后可能产生出的整数为(包括原数): 234 534 264 564 共 4 种不同的产生数描述...原创 2018-03-22 18:40:41 · 297 阅读 · 0 评论 -
[HDU 5723]Abandoned country
Time Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Problem Description An abandoned country has n(n≤100000)n(n≤100000)n(n≤100000) villages which are numbered from 111 ...原创 2018-05-26 19:52:11 · 228 阅读 · 0 评论 -
[codeforces 982C]
C. Cut ‘em all! time limit per test : 1 second memory limit per test : 256 megabytesYou’re given a tree with nnn vertices. Your task is to determine the maximum possible number of edges that can ...原创 2018-06-08 22:18:53 · 352 阅读 · 0 评论 -
[codeforces][gym101059C]Gangsters
time limit per test:5.0 s memory limit per test:64 MBYou live in a graph G, with N vertices and M edges. P of these vertices have gangsters living on them. You owe each gangster some money, given b...原创 2018-08-29 22:12:52 · 266 阅读 · 0 评论 -
[BZOJ1103][POI2007]大都市meg
Time Limit: 10 SecMemory Limit: 162 MBDescription在经济全球化浪潮的影响下,习惯于漫步在清晨的乡间小路的邮递员Blue Mary也开始骑着摩托车传递邮件了。不过,她经常回忆起以前在乡间漫步的情景。昔日,乡下有依次编号为1…n的n个小村庄,某些村庄之间有一些双向的土路。从每个村庄都恰好有一条路径到达村庄1(即比特堡)。并且,对于每个村庄,它到比特...原创 2018-10-26 19:30:33 · 181 阅读 · 0 评论 -
[BZOJ2208][Jsoi2010]连通数
Time Limit: 20 SecMemory Limit: 512 MBDescriptionInput输入数据第一行是图顶点的数量,一个正整数N。 接下来N行,每行N个字符。第i行第j列的1表示顶点i到j有边,0则表示无边。Output输出一行一个整数,表示该图的连通数。Sample Input3 010 001 100 Sample Output9HINT...原创 2018-10-26 22:29:53 · 232 阅读 · 0 评论 -
[codeforces1092F]Tree with Maximum Cost
You are given a tree consisting exactly of nnn vertices. Tree is a connected undirected graph with n−1n−1n−1 edges. Each vertex vvv of this tree has a value ava_vav assigned to it.Let dist(x,y)dist(...原创 2018-12-25 23:52:29 · 202 阅读 · 0 评论 -
[codeforces1118F1]Tree Cutting (Easy Version)
time limit per test : 2 secondsmemory limit per test : 256 megabytesYou are given an undirected tree of nnn vertices.Some vertices are colored blue, some are colored red and some are uncolored. It ...原创 2019-02-20 17:53:15 · 314 阅读 · 0 评论 -
[codeforces1214D]Treasure Island
time limit per test : 1 secondmemory limit per test : 512 megabytes分数:1800 但是感觉确实有难度()All of us love treasures, right? That’s why young Vasya is heading for a Treasure Island.Treasure Island may b...原创 2019-09-08 11:37:09 · 579 阅读 · 3 评论