#P1224. [NOI2013] 向量内积

    ID: 224 远端评测题 1000~5000ms 256MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2013NOI 系列Special Judge矩阵乘法向量

[NOI2013] 向量内积

Description

{{The dot product of two dd-dimensional vectors A=[a1,a2,,ad]A=[a_1,a_2,\ldots,a_d] and B=[b1,b2,,bd]B=[b_1,b_2,\ldots,b_d] is the sum of the products of their corresponding coordinates, i.e.:

$$(A,B)=\sum_{i=1}^d a_ib_i=a_1b_1+a_2b_2+\ldots+a_db_d$$

Given nn dd-dimensional vectors x1,,xnx_1,\ldots,x_n, Xiao Miaomiao (pinyin) wants to know whether there exist two vectors whose dot product is a multiple of kk. Please help her solve this problem.}}

Input Format

{{The first line contains 33 positive integers n,d,kn, d, k, representing the number of vectors, the dimension, and the multiple to check, respectively.

The next nn lines each contain dd non-negative integers. In the ii-th line, the jj-th integer is the jj-th coordinate value xi,jx_{i,j} of vector xix_i.}}

Output Format

{{Output two integers separated by a space.

If there exist two vectors xp,xqx_p, x_q whose dot product is an integer multiple of kk, output their indices pp and qq (require p<qp<q). If there are multiple valid pairs, output any one of them.

If no such pair exists, output two 1-1.}}

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

2 3

Hint

{{### Constraints

Test point ID nn dd kk xi,jx_{i,j}
11 22 2020 22 10\leq 10
22 55 ^ ^
33 1010 2020 33
44 2020 22 100\leq 100
55 5050 33 ^
66 5050 22 103\leq 10^3
77 33 3×106\leq 3\times 10^6
88 8080 22 2×106\leq 2\times 10^6
99 100100 33 3×106\leq 3\times 10^6
1010 500500 ^ ^
1111 10310^3 22 2×106\leq 2\times 10^6
1212 33 3×106\leq 3\times 10^6
1313 10410^4 22 <10<10
1414 33 ^
1515 1.5×1041.5\times 10^4 22
1616 1.8×1041.8\times 10^4 ^
1717 2×1042\times 10^4
1818 5×1045\times 10^4 3030 33
1919 8×1048\times 10^4 ^
2020 10510^5

Translated by ChatGPT 5