All submissions for this problem are available.
A hyperplane in N dimensions can be represented by the following equation:
a1x1 + a2x2 + ... + aNxN + aN+1 = 0
Your task is to calculate the intersection point of N hyperplanes. It is guaranteed that the provided hyperplanes intersect at a unique point.
The first line of the input contains an integer N denoting the number of hyperplanes. The following N lines describe the coefficients a1 to aN of the hyperplanes, and the jth number in the ith line denotes coefficient aj of the ith hyperplane.
The next line contains the integer Q, the number of problem instances to solve. Each of the next Q lines contains N integers, where the ith integer denotes the coefficient aN+1 of the ith hyperplane.
Output N integers per line for each of the Q instances, which denote the coordinates of the intersection point of the hyperplanes, i.e. x1 to xN. Output the coordinates modulo 1000000007.
- 1 ≤ N ≤ 300
- 1 ≤ Q ≤ 300
- -109 ≤ ai ≤ 109
Input: 3 1 2 1 4 3 2 5 0 6 2 4 5 2 3 1 0 Output: 920000007 840000004 400000002 760000007 520000002 200000000 Explanation: After substituting the values of x1 to xN in the equation, you will find that the sum is 0 modulo
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.