CF95C Volleyball】的更多相关文章

题意翻译 给出一个图,双向边,边上有权值代表路的距离,然后每个点上有两个值,t,c,t代表能从这个点最远沿边走t,且不能在半路下来,花费是c 现在告诉你起点终点,问最少的花费 点个数1000,边个数1000,边权1e9 By @partychicken 题目描述 Petya loves volleyball very much. One day he was running late for a volleyball match. Petya hasn't bought his own car…
D. Volleyball http://codeforces.com/contest/96/problem/D 题意: n个路口,m条双向路,每条长度为w.每个路口有一个出租车司机,最多可以乘坐这辆车走长度只要坐他的车,就必须交c元,最多可以载你走的长度为t的路.问从x到y的最小花费是多少. 分析: 第一遍SPFA求出每个点它能到的所有点,边权就是乘坐出租车的费用,第二遍直接跑最短路.稀疏图用了spfa 代码: #include<cstdio> #include<algorithm&g…
Petya loves volleyball very much. One day he was running late for a volleyball match. Petya hasn't bought his own car yet, that's why he had to take a taxi. The city has n junctions, some of which are connected by two-way roads. The length of each ro…
题目链接:http://codeforces.com/problemset/problem/95/C C. Volleyball time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Petya loves volleyball very much. One day he was running late for a volleyb…
题目链接:http://codeforces.com/contest/95/problem/C 思路:首先dijkstra预处理出每个顶点到其他顶点的最短距离,然后如果该出租车到某个顶点的距离小于等于最短距离,就连边,费用为一开始出租车所需的费用,建好图之后再求一次最短路即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <…
https://www.hackerrank.com/contests/w1/challenges/volleyball-match 此题不错,首先可以看出是DP,S(x, y)= S(x - 1, y) + S(x, y - 1).然后比赛结束状态需要认真判断.三来,最后数据量很大(接近10^9)远超一般DP的数据量,分配数组都不行,里面是有规律的.下面是大数据失败的代码: #include <vector> #include <iostream> #include <cs…
题意:一个无向图,有n个点,m条边,每条边有距离w,每个点有两个属性(1.从这点出发能到的最远距离,2.从这点出发的费用(不论走多远都一样)),一个人要从点x到点y,问最小费用是多少. 题目链接:http://codeforces.com/problemset/problem/96/D ——>>前n次SPFA用来建图(以费用为权值重新建图),建好图好再一次SPFA求小最小费用. 要小心新图的边数,边数可能会增长得很快,这地方我开得不够大WA数次... #include <cstdio&g…
题意与分析 这题也是傻逼题,可是我当时打比赛的时候板子出问题了- -|||,怎么调也调不过. 不过思路是很清晰的:先做n次dijkstra然后重新建图,建完了以后根据新的单向图再跑一次dijkstra. 代码 #include <bits/stdc++.h> #define ZERO(x) memset(x, 0, sizeof(x)) using namespace std; using ll=long long; struct Edge { int v, nxt; ll c; }; Edg…
[题目链接]:http://codeforces.com/problemset/problem/95/C [题意] 给你n个点,m条边; 每个点有一辆出租车; 可以到达离这个点距离不超过u的点,且在这个距离范围里面,路费都是v; 问你从起点到终点的最小花费; [题解] 重新建图; 每个点; 连一条边到这个点的出租车能够到达的点(从每个点求最短路); 然后边权都是v; 然后在从这个新建的图上从起点开始跑最短路; [Number Of WA] 0 [完整代码] #include <bits/stdc…
安装:我是按这篇来弄的 一.Insert 1.db.person.insert({"name":"jack","age":20}) 2.var single={"name":"joe","age":20,"address":{"province":"zhejiang","city":"hangzho…