Construct a square matrix with NN rows and NN columns consisting of nonnegative integers from 00 to 10^{18}1018, such that its determinant is equal to 11, and there are exactly A_iAi​ odd numbers in the ii-th row for each ii from 11 to NN, or report there isn't such a matrix. Standard input The first line contains a single integer NN. Each of the next NN lines contains a single integer A_iAi​. Standard output If there is no solution, output \text{-}1-1. Otherwise, print NN lines, each consisting of NN integers, representing the values of the constructed matrix. If there are multiple solutions, print any. Constraints and notes 2 \le N \le 502≤N≤50 1 \leq A_i \leq N1≤Ai​≤N For 40\%40% of the test files, N \le 17N≤17.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Construct a square matrix with NN rows and NN columns consisting of nonnegative integers from 00 to 10^{18}1018, such that its determinant is equal to 11, and there are exactly A_iAi​ odd numbers in the ii-th row for each ii from 11 to NN, or report there isn't such a matrix. Standard input The first line contains a single integer NN. Each of the next NN lines contains a single integer A_iAi​. Standard output If there is no solution, output \text{-}1-1. Otherwise, print NN lines, each consisting of NN integers, representing the values of the constructed matrix. If there are multiple solutions, print any. Constraints and notes 2 \le N \le 502≤N≤50 1 \leq A_i \leq N1≤Ai​≤N For 40\%40% of the test files, N \le 17N≤17.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY