Kattis

Partial Linear Equation Solver

Input

There are several test cases. Each test case begins with a line containing an integer $n$, where $1 \leq n \leq 100$.

Then follow $n$ lines, each containing $n$ floating point numbers. The $j$:th number on the $i$:th row gives the entry $a_{i,j}$ of the matrix $A$. Then follows one line containing $n$ floating point numbers, the $i$:th of which is the $i$:th element of the vector $b$.

The input is ended with a case where $n = 0$.

Output

For each operation in each test case, output the vector $x$ giving the solution to the system of equations $Ax = b$. For variables for which there are more than one possible value, output “?”. If the system is inconsistent, output “inconsistent”.

Sample Input 1 Sample Output 1
2
1 1
0 1
23 42
1
5
1
3
1 -2 0
2 -4 0
1 -2 1
3 6 4
3
1 1 0
3 3 0
0 1 2
1 4 8
0

-19 42
0.20
? ? 1.00
inconsistent
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.9035742282867432, "perplexity": 312.8505436942607}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 5, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2021-17/segments/1618038088471.40/warc/CC-MAIN-20210416012946-20210416042946-00268.warc.gz"}