ZHY's Blog

#include < bits/stdc++.h >


  • 首页

  • 关于

  • 标签

  • 分类

  • 归档

  • 搜索

POJ-3268 Silver Cow Party (Dijkstra + 逆向建边)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 706 | 阅读时长 ≈ 4

描述

传送门:Silver Cow Party

One cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirectional (one-way roads connects pairs of farms; road i requires Ti (1 ≤ Ti ≤ 100) units of time to traverse.

Each cow must walk to the party and, when the party is over, return to her farm. Each cow is lazy and thus picks an optimal route with the shortest time. A cow’s return route might be different from her original route to the party since roads are one-way.

Of all the cows, what is the longest amount of time a cow must spend walking to the party and back?

阅读全文 »

POJ-3259 Wormholes (SPFA 判定负环)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 768 | 阅读时长 ≈ 4

描述

传送门:POJ-3259 Wormholes

While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that is BEFORE you entered the wormhole! Each of FJ’s farms comprises N (1 ≤ N ≤ 500) fields conveniently numbered 1..N, M (1 ≤ M ≤ 2500) paths, and W (1 ≤ W ≤ 200) wormholes.

As FJ is an avid time-traveling fan, he wants to do the following: start at some field, travel through some paths and wormholes, and return to the starting field a time before his initial departure. Perhaps he will be able to meet himself :) .

To help FJ find out whether this is possible or not, he will supply you with complete maps to F (1 ≤ F ≤ 5) of his farms. No paths will take longer than 10,000 seconds to travel and no wormhole can bring FJ back in time by more than 10,000 seconds.

阅读全文 »

POJ-2253 Frogger(建图+最短路变形or最小生成树)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 796 | 阅读时长 ≈ 5

描述

传送门:POJ-2253 Frogger

Freddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tourists’ sunscreen, he wants to avoid swimming and instead reach her by jumping.
Unfortunately Fiona’s stone is out of his jump range. Therefore Freddy considers to use other stones as intermediate stops and reach her by a sequence of several small jumps.
To execute a given sequence of jumps, a frog’s jump range obviously must be at least as long as the longest jump occuring in the sequence.
The frog distance (humans also call it minimax distance) between two stones therefore is defined as the minimum necessary jump range over all possible paths between the two stones.

You are given the coordinates of Freddy’s stone, Fiona’s stone and all other stones in the lake. Your job is to compute the frog distance between Freddy’s and Fiona’s stone.

阅读全文 »

POJ-2387 Til the Cows Come Home (Dijkstra or SPFA 水题)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 518 | 阅读时长 ≈ 3

描述

传送门:text

Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get back as quickly as possible.

Farmer John’s field has N (2 <= N <= 1000) landmarks in it, uniquely numbered 1..N. Landmark 1 is the barn; the apple tree grove in which Bessie stands all day is landmark N. Cows travel in the field using T (1 <= T <= 2000) bidirectional cow-trails of various lengths between the landmarks. Bessie is not confident of her navigation ability, so she always stays on a trail from its start to its end once she starts it.

Given the trails between the landmarks, determine the minimum distance Bessie must walk to get back to the barn. It is guaranteed that some such route exists.

阅读全文 »

POJ-1125 Stockbroker Grapevine(Floyd)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 1,191 | 阅读时长 ≈ 6

描述

传送门:POJ-1125 Stockbroker Grapevine

Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market. For maximum effect, you have to spread the rumours in the fastest possible way.

Unfortunately for you, stockbrokers only trust information coming from their “Trusted sources” This means you have to take into account the structure of their contacts when starting a rumour. It takes a certain amount of time for a specific stockbroker to pass the rumour on to each of his colleagues. Your task will be to write a program that tells you which stockbroker to choose as your starting point for the rumour, as well as the time it will take for the rumour to spread throughout the stockbroker community. This duration is measured as the time needed for the last person to receive the information.

阅读全文 »

POJ-1511 Invitation Cards(双向单源最短路 Dijstra+heap or SPFA)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 942 | 阅读时长 ≈ 6

描述

传送门:POJ-1511 Invitation Cards

In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They have printed invitation cards with all the necessary information and with the programme. A lot of students were hired to distribute these invitations among the people. Each student volunteer has assigned exactly one bus stop and he or she stays there the whole day and gives invitation to people travelling by bus. A special course was taken where students learned how to influence people and what is the difference between influencing and robbery.

The transport system is very special: all lines are unidirectional and connect exactly two stops. Buses leave the originating stop with passangers each half an hour. After reaching the destination stop they return empty to the originating stop, where they wait until the next full half an hour, e.g. X:00 or X:30, where ‘X’ denotes the hour. The fee for transport between two stops is given by special tables and is payable on the spot. The lines are planned in such a way, that each round trip (i.e. a journey starting and finishing at the same stop) passes through a Central Checkpoint Stop (CCS) where each passenger has to pass a thorough check including body scan.

All the ACM student members leave the CCS each morning. Each volunteer is to move to one predetermined stop to invite passengers. There are as many volunteers as stops. At the end of the day, all students travel back to CCS. You are to write a computer program that helps ACM to minimize the amount of money to pay every day for the transport of their employees.

阅读全文 »

POJ-1979 Heavy Transportation (最大生成树)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 718 | 阅读时长 ≈ 4

描述

传送门:POJ-1979 Heavy Transportation

Background
Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the place his customer has build his giant steel crane to the place where it is needed on which all streets can carry the weight.
Fortunately he already has a plan of the city with all streets and bridges and all the allowed weights.Unfortunately he has no idea how to find the the maximum weight capacity in order to tell his customer how heavy the crane may become. But you surely know.

Problem
You are given the plan of the city, described by the streets (with weight limits) between the crossings, which are numbered from 1 to n. Your task is to find the maximum weight that can be transported from crossing 1 (Hugo’s place) to crossing n (the customer’s place). You may assume that there is at least one path. All streets can be travelled in both directions.

阅读全文 »

HYSBZ-2038 小Z的袜子(hose)(莫队)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 数据结构 | | 阅读次数: |
字数统计: 1,621 | 阅读时长 ≈ 8

描述

传送门:[2009国家集训队]小Z的袜子(hose)

作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命……
具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L 尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一左一右,他却很在意袜子的颜色,毕竟穿两只不同色的袜子会很尴尬。
你的任务便是告诉小Z,他有多大的概率抽到两只颜色相同的袜子。当然,小Z希望这个概率尽量高,所以他可能会询问多个(L,R)以方便自己选择。

阅读全文 »

UVA-10305 Ordering Tasks(拓扑序 水题)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 471 | 阅读时长 ≈ 3

描述

传送门:UVA-10305 Ordering Tasks

John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is
only possible if other tasks have already been executed.

阅读全文 »

HDU-1285 确定比赛名次(拓扑序)

发表于 2018-08-04 | 更新于: 2018-08-04 | 分类于 题解 , 图论 | | 阅读次数: |
字数统计: 588 | 阅读时长 ≈ 3

描述

传送门:HDU-1285 确定比赛名次

有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。

阅读全文 »
12345
卓华寅

卓华寅

人一我百!人十我万!永不放弃~~~怀着自信的心,去追逐梦想——kuangbin

44 日志
14 分类
25 标签
RSS
Creative Commons
友情链接
  • findBUG.top
  • SWOJ
  • Vjudge
  • 张松超
  • 潘坤
  • 王亚东
  • 何世全
  • 朱成锐
  • 曹雨菲
  • kuangbin
0%
© 2018 卓华寅 | Site words total count: 32.1k
由 Hexo 强力驱动
|
主题 — NexT.Gemini v5.1.4