Yep, something like
define A[1..n]
Gen(k, l):
if(k==0)
print A;
for(i=1; i<=l; i++)
Gen(k-1, A[k]=i);
And, in your case, you should call Gen(n, 3), since you want it with 3
numbers (e.g. s,d,t will equal 1,2,3)
On Jul 9, 12:18 pm, Miroslav Balaz wrote:
> LOL, you should heve some
, 5:48 am, Spiritus wrote:
> I have an idea for D as well.
>
> First, suppose we are given an upper bound T on the projects finish
> time. we thus want to assign jobs for each employee that this
> employees total time doesn't exceed this upper bound T.
> This we can do using d
out 1,000,000.
All that we have to do now is to binary search the value for T, this
adds a log T, so overall, we have O(M^2 * N * lg T)
On Jul 10, 5:15 am, Spiritus wrote:
> Problem B:
> My idea is to have a set(can be implemented using STL's std::set) with
> key being a pair (dx,
product.
This is, I believe, if Im not completely mistaken, O(M log N + N log
N).
On Jul 10, 5:15 am, Spiritus wrote:
> Problem B:
> My idea is to have a set(can be implemented using STL's std::set) with
> key being a pair (dx,dy).
> now, i go through all pairs of points, and i
Problem B:
My idea is to have a set(can be implemented using STL's std::set) with
key being a pair (dx,dy).
now, i go through all pairs of points, and i construct the key(x_1-
x_0,y_1,y_0) for them. The idea is that if i have L pairs each with
the same (dx,dy), every two pairs make a parallelogram
Yeah, its from ioi.
1)the solution is on their site.
basically there are like 6 ways to put rectangles together given their
order and orientation.
so, you just loop through all permutations and orientation, and try
each of the 6 possibilities(which are shown on their site), and select
a minimum.
1. u should calculate the k variable, that is
if i+j=3 (i=1, j=2, or vice versa) then k=3
if i+j=4 (i=1, j=3, or vice versa) then k=2
if i+j=5 (i=2, j=3, or vice versa) then k=1
2. the last question give the answer to the last 2:
T(m) = 1 if n = 1
2*T(m - 1) + 1 if n > 1
is the reccurence relati
You first find the greatest N values for each array.(No need for it
here, because both arrays are of size N)
The first pair will be both maximums(or maxima, actually, in greek).
then, in a way of Merge(Nonincreasing order), we pick the next pairs.
--~--~-~--~~~---~--~