QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100

#7977. 彩虹航线

統計

A 国和 B 国各有 $ n $ 个机场,两国间有 $ m $ 条航线。

每条航线都有 $ k $ 种不同的备选颜色。保证所有机场起飞的航线数量不超过 $ k $

第 $ i $ 条航线往返于 A 国的机场 $ u_i $ 和 B 国的机场 $ v_i $,其第 $ j $ 种备选颜色为 $ c_{i, j} $。

给每条航线选择一种备选颜色,使得同一个机场起飞的航线的颜色互不相同。

输入格式

第一行三个整数 $ n, m, k $。

接下来 $ m $ 行,第 $ i $ 行 $ k + 2 $ 个整数 $ u_i, v_i, c_{i, 1}, c_{i, 2}, \cdots, c_{i, k} $。

输出格式

一行 $ m $ 个整数 $ a_1, a_2, \cdots, a_m $,表示第 $ i $ 条航线的颜色为 $ a_i $。

如果有多种方案,给出任意一种即可。保证存在至少一种合法方案。

样例输入

2 4 2
1 1 1 2 
1 2 2 3
2 1 1 3
2 2 2 3

样例输出

2 3 3 2

数据范围

保证 $ 1 \leq n, k \leq 150, 1 \leq m \leq n^2, 1 \leq c_{i, j} \leq \min(10^6, mk), 1 \leq u_i, v_i \leq n $。

保证不存在两条航线重合的情况,即不存在 $ i \neq j $ 满足 $ (u_i, v_i) = (u_j, v_j) $。

子任务编号特殊性质分值
$ 1 $$ k = 1 $$ 1 $
$ 2 $$ k = 2n $$ 2 $
$ 3 $$ k = 2 $$ 11 $
$ 4 $$ m = n^2, k = n + 1 $$ 37 $
$ 5 $$ m = n^2 $$ 21 $
$ 6 $$ 28 $
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.