A1304 | [COCI-2013_2014-contest4]#5 UTRKA
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Mirko and Slavko are the only two contestants at the Grand Prix of Dabrovina Donja which is driven through nearby villages. The villages are connected via one-way roads, and for each road i we know Mi and Si , the time necessary for Mirko and Slavko to cross that road. The race itself is circular (meaning it starts and begins in the same village), but the route itself hasn't been determined yet.
Mirko has bribed the organisers of the race so they'd pick a route in his favour. Specifically, the organisers are going to pick the shortest route (containing the minimal number of roads) such that Mirko is strictly faster than Slavko on that route. If, by any chance, there are several such routes, the organisers choose the one where Mirko gains maximal advantage.
Mirko has bribed the organisers of the race so they'd pick a route in his favour. Specifically, the organisers are going to pick the shortest route (containing the minimal number of roads) such that Mirko is strictly faster than Slavko on that route. If, by any chance, there are several such routes, the organisers choose the one where Mirko gains maximal advantage.
输入格式
The first line of input contains two integers N, M (2 ≤ N ≤ 300, 2 ≤ M ≤ N(N-1)), the number of villages and the number of connecting roads.
Each of the following M lines contains 4 integers Ai , Bi , Mi , Si (1 ≤ Ai , Bi ≤ N, Ai ≠ Bi , 0 ≤ Si , Mi ≤
106 ). Respectively, the initial and ending village of the i th road, the time necessary for Mirko and the time necessary for Slavko to cross that road. There won't exist two different roads that connect the same pair of villages in the same direction.
Each of the following M lines contains 4 integers Ai , Bi , Mi , Si (1 ≤ Ai , Bi ≤ N, Ai ≠ Bi , 0 ≤ Si , Mi ≤
106 ). Respectively, the initial and ending village of the i th road, the time necessary for Mirko and the time necessary for Slavko to cross that road. There won't exist two different roads that connect the same pair of villages in the same direction.
输出格式
The first and only line of output must contain two integers: the shortest possible route (with the minimal number of roads) such that Mirko wins, and the maximal advantage Mirko can gain on a route of the shortest length.
Please note: The input data will be such that a route which meets the conditions from the text will always exist.
Please note: The input data will be such that a route which meets the conditions from the text will always exist.
输入输出样例
输入 #1
3 4 1 2 3 0 2 3 3 0 3 1 0 100 2 1 0 4
输出 #1
2 1
输入 #2
5 7 1 2 4 1 2 3 5 1 3 1 1 6 1 3 15 5 2 4 7 5 4 5 1 4 5 3 1 0
输出 #2
5 2
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted