QOJ.ac

QOJ

Time Limit: 5 s Memory Limit: 256 MB Total points: 100

#6777. 向量内积

统计

两个 $d$ 维向量 $A=[a_1,a_2,\dots,a_d]$ 与 $B=[b_1,b_2,\dots,b_d]$ 的内积为其相对应维度的权值的乘积和,即:

\begin{equation} \langle A, B\rangle = \sum_{i = 1}^{d} a_i b_i = a_1 b_1 + a_2 b_2 + \dots + a_d b_d \end{equation}

现在有 $n$ 个 $d$ 维向量 $x_1, x_2, \dots, x_n$,小喵喵想知道是否存在两个向量的内积为 $k$ 的倍数。请帮助她解决这个问题。

输入格式

第一行包含 $3$ 个正整数 $n,d,k$,分别表示向量的个数,维数以及待检测的倍数。

接下来 $n$ 行每行有 $d$ 个非负整数,其中第 $i$ 行的第 $j$ 个整数表示向量 $x_i$ 的第 $j$ 维权值 $x_{i,j}$。

输出格式

包含两个整数,用空格隔开。

如果存在两个向量 $x_p,x_q$ 的内积为 $k$ 的整数倍,则输出两个向量的编号 $p$ 与 $q$ (要求 $p < q$)。如果存在多组这样的向量组合,输出其中任意一组即可。

若不存在这样的向量组合,则输出两个 $-1$。

样例数据

样例 1 输入

3 5 2
1 0 1 0 1
1 1 0 1 0
0 1 0 1 1

样例 1 输出

2 3

样例 1 解释

$\langle x_1, x_2 \rangle = 1$,$\langle x_1, x_3 \rangle = 1$,$\langle x_2, x_3 \rangle = 2$。

样例 2

见下发文件。

样例 3

见下发文件。

限制与约定

测试点编号 $n$ $d$ $k$ $x_{i, j}$
1$2$$20$$2$$\leq 10$
2$5$$20$$2$$\leq 10$
3$10$$20$$3$$\leq 10$
4$20$$20$$2$$\leq 100$
5$50$$20$$3$$\leq 100$
6$50$$50$$2$$\leq 1000$
7$50$$50$$3$$\leq 3000000$
8$80$$80$$2$$\leq 3000000$
9$100$$100$$3$$\leq 3000000$
10$500$$100$$3$$\leq 3000000$
11$1000$$100$$2$$\leq 3000000$
12$1000$$100$$3$$\leq 3000000$
13$10000$$100$$2$$\lt 10$
14$10000$$100$$3$$\lt 10$
15$15000$$100$$2$$\lt 10$
16$18000$$100$$2$$\lt 10$
17$20000$$100$$2$$\lt 10$
18$50000$$30$$3$$\lt 10$
19$80000$$30$$3$$\lt 10$
20$100000$$30$$3$$\lt 10$
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.