codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

1220B.md (1380B)


      1 Source: https://codeforces.com/problemset/problem/1220/B
      2 
      3 B. Multiplication Table
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Sasha grew up and went to first grade. To celebrate this event her mother bought her a multiplication table $M$ with $n$ rows and $n$ columns such that $M_{ij}=a_i \cdot a_j$ where $a_1, \dots, a_n$ is some sequence of positive integers.
     22 
     23 Of course, the girl decided to take it to school with her. But while she was having lunch, hooligan Grisha erased numbers on the main diagonal and threw away the array $a_1, \dots, a_n$. Help Sasha restore the array!
     24 
     25 Input
     26 
     27 The first line contains a single integer $n$ ($3 \leqslant n \leqslant 10^3$), the size of the table.
     28 
     29 The next $n$ lines contain $n$ integers each. The $j$-th number of the $i$-th line contains the number $M_{ij}$ ($1 \leq M_{ij} \leq 10^9$). The table has zeroes on the main diagonal, that is, $M_{ii}=0$.
     30 
     31 Output
     32 
     33 In a single line print $n$ integers, the original array $a_1, \dots, a_n$ ($1 \leq a_i \leq 10^9$). It is guaranteed that an answer exists. If there are multiple answers, print any.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 5
     41 0 4 6 2 4
     42 4 0 6 2 4
     43 6 6 0 3 6
     44 2 2 3 0 2
     45 4 4 6 2 0
     46 ```
     47 
     48 Output
     49 
     50 ```
     51 2 2 3 1 2
     52 ```
     53 
     54 Input
     55 
     56 ```
     57 3
     58 0 99990000 99970002
     59 99990000 0 99980000
     60 99970002 99980000 0
     61 ```
     62 
     63 Output
     64 
     65 ```
     66 9999 10000 9998
     67 ```