QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#16716. Infinite Gift

Statistics

Vasya the Infinite 收到了一份非常无聊的礼物——整数格点 $\mathbb{Z}^k$。形式上,该格点由所有具有整数坐标的 $k$ 维向量组成。

对这份礼物感到失望的 Vasya 决定让这个格点变得更漂亮一些。他执行了以下步骤 $n$ 次:选择一个向量 $v_i \in \mathbb{Z}^k$,然后对于每个元素 $a \in \mathbb{Z}^k$,用一根细绳连接 $a$ 和 $a + v_i$。请注意,Vasya 可能会多次选择相同的向量,但他从未选择过零向量 $v_i = (0, \dots, 0)$。

在完成了这个繁琐的过程后,Vasya 发现格点现在是连通的,也就是说,对于任意一对元素 $a, b \in \mathbb{Z}^k$,都可以通过沿着细绳移动若干次从 $a$ 到达 $b$。每根细绳都允许双向通行。

为了让格点变得更加漂亮,Vasya 现在想将格点中的每个向量染成白色或黑色,使得任何由细绳直接相连的两个向量都具有不同的颜色。Vasya 的耐心是有限的,所以你需要快点帮他!

输入格式

第一行包含两个整数 $n$ 和 $k$ ($1 \le k \le n \le 1500$) — Vasya 选择向量的次数和格点的维度。

接下来的 $n$ 行描述向量 $v_1, v_2, \dots, v_n$。其中第 $i$ 行包含 $k$ 个整数 $v_{i,1}, \dots, v_{i,k}$ ($-1000 \le v_{i,j} \le 1000$)。保证所有向量 $v_i$ 均非零,且格点是连通的。

输出格式

如果可以对格点进行二染色,则输出 "Yes",否则输出 "No"。

样例

输入样例 1

2 2
1 0
0 1

输出样例 1

Yes

输入样例 2

3 2
1 0
0 1
1 1

输出样例 2

No

输入样例 3

2 1
1
-3

输出样例 3

Yes

说明

在第一个样例中,棋盘染色是格点的一种有效染色方案。

在第二个样例中,向量 $(0, 0)$、$(1, 0)$、$(1, 1)$ 之间不存在有效的染色方案。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.