The honeycomb walk och Tomography problem i java

Permalänk
Medlem

The honeycomb walk och Tomography problem i java

Hej!

Är det någon här som har kunskaper om programmeringsproblemen honeycomb walk och tomography för java? I honeycomb walk kom jag över en lösning men undrar hur man ska tänka kring uppgiften för att förstå den.

I uppgiften tomography har jag inte hittat någon lösning och vet inte hur jag ska börja och behöver hjälp med hur problemet kan lösas. Här nedan är själva problemet:

Binary tomography deals with the problem of reconstructing binary images from a small number of projections. One of its most basic problems is to construct a binary ({0,1}{0,1}-valued) matrix with given row and column sums. This is not always possible and your task is to determine when it is.

Input
The first line of input contains two numbers 1≤m,n≤10001≤m,n≤1000, the number of rows and columns of the matrix. The next line contains mm numbers 0≤ri≤n0≤ri≤n – the sum of each row in the matrix. The third line contains nn numbers 0≤cj≤m0≤cj≤m – the sum of each column in the matrix.

Output
Output “Yes” if there exists an mm-by-nn matrix AA, with each element either beeing 0 or 1, such that

∑j=1nAi,j=ri∀i∈{1,2,…,m} and ∑i=1mAi,j=cj∀j∈{1,2,…,n}.
∑j=1nAi,j=ri∀i∈{1,2,…,m} and ∑i=1mAi,j=cj∀j∈{1,2,…,n}.

Otherwise output “No”.

Tacksam för all hjälp!