QOJ.ac

QOJ

Time Limit: 0.5 s Memory Limit: 128 MB Total points: 100

#4180. 晨跑

统计

Time Limit: 1s → 0.5s

Elaxia 最近迷恋上了空手道,他为自己设定了一套健身计划,比如俯卧撑、仰卧起坐等等,不过到目前为止,他坚持下来的只有晨跑。 现在给出一张学校附近的地图,这张地图中包含 $N$ 个十字路口和 $M$ 条街道,Elaxia 只能从一个十字路口跑向另外一个十字路口,街道之间只在十字路口处相交。Elaxia每天从寝室出发跑到学校,保证寝室编号为 $1$,学校编号为 $N$。 Elaxia的晨跑计划是按周期(包含若干天)进行的,由于他不喜欢走重复的路线,所以在一个周期内,每天的晨跑路线都不会相交(在十字路口处),寝室和学校不算十字路口。Elaxia 耐力不太好,他希望在一个周期内跑的路程尽量短,但是又希望训练周期包含的天数尽量长。 除了练空手道,Elaxia其他时间都花在了学习和找 MM 上面,所有他想请你帮忙为他设计 一套满足他要求的晨跑计划。

输入格式

第一行:两个数 $N,M$。表示十字路口数和街道数。

接下来 $M$ 行,每行 $3$ 个数 $a,b,c$,表示路口 $a$ 和路口 $b$ 之间有条长度为 $c$ 的街道(单向)。

输出格式

两个数,第一个数为最长周期的天数,第二个数为满足最长天数的条件下最短的路程长 度。

样例数据

样例输入

7 10
1 2 1
1 3 1
2 4 1
3 4 1
4 5 1
4 6 1
2 5 5
3 6 6
5 7 1
6 7 1

样例输出

2 11

子任务

测试点 $N$ $M$
$1$ $5$ $8$
$2$ $10$ $30$
$3$ $20$ $120$
$4$ $50$ $1\,000$
$5$ $100$ $3\,000$
$6 \sim 7$ $100$ $8\,000$
$8$ $200$ $10\,000$
$9$ $200$ $12\,000$
$10$ $200$ $20\,000$

对于所有数据,$1 \leq N \leq 200, 1 \leq M \leq 20\,000$。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.