Quest of Video Compression

Arpit Bhayani

curious, tinkerer, and explorer


Question

AsliVideo is revolutionizing their video streaming platform! They’ve developed N different compression algorithms and tested them on M different types of video content. For each video type, they know:

  1. How many units of processing power each algorithm consumes
  2. The total compression score achieved when all algorithms work together

The engineering team needs to determine each algorithm’s individual contribution to the compression score.

  • The first line contains two integers N and M (1 ≤ N, M ≤ 100) — the number of algorithms and video types respectively
  • The next M lines each contain N+1 integers:
    • First N integers p[i] (0 ≤ p[i] ≤ 1000) represent the processing power units (cpu cycles) required by each algorithm for this video type
    • The last integer s (0 ≤ s ≤ 10000) represents the total compression score achieved for this video type

Output

  • Output N space-separated floating-point numbers — the individual contribution of each algorithm to the compression score
  • the absolute or relative error should not exceed 10^-6
  • If you think there is no solution for the given input, output “observation error”

Example

Input:
3 3
2 1 3 95
1 3 1 82
3 2 1 75

Output:
5.58823529 18.17647059 21.88235294
Input:
3 3
2 1 0 95
1 3 0 82
3 2 0 75

Output:
observation error

Solution

Solution of the question will be uploaded on coming Wednesday.

Arpit Bhayani

Creator of DiceDB, ex-Google Dataproc, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses


Arpit's Newsletter read by 100,000 engineers

Weekly essays on real-world system design, distributed systems, or a deep dive into some super-clever algorithm.