### Problem 3277 : Workshops

Posted:

**Mon Feb 27, 2006 9:14 pm**Any hints how to do this.... I tried to think of possible greedy algs, but each one seemed to have a snag...

Thanks....

Thanks....

The UVa Online Judge board

https://uva.onlinejudge.org/board/

https://uva.onlinejudge.org/board/viewtopic.php?f=27&t=10047

Page **1** of **1**

Posted: **Mon Feb 27, 2006 9:14 pm**

Any hints how to do this.... I tried to think of possible greedy algs, but each one seemed to have a snag...

Thanks....

Thanks....

Posted: **Thu Mar 30, 2006 11:57 pm**

We solved it in contest by Graph matching.

Posted: **Mon Feb 05, 2007 4:34 am**

Do you mean weighted bipartite matching?Moha wrote:We solved it in contest by Graph matching.

I've been attempting to implement this using Ford-Fulkerson and a modified Dijkstra (to avoid the problem of negative weighted edges). However, it is too slow: O(v^3) where v=1000.

Could you give details about how you solved it?

Posted: **Sun Feb 18, 2007 12:47 am**

You can solve it using greedy alg.

it will take O(nlogn+rlogr+ nr).

if you make a good implementation, it will be reduced into O(xlogx), but it is not necessary (i guess).

it will take O(nlogn+rlogr+ nr).

if you make a good implementation, it will be reduced into O(xlogx), but it is not necessary (i guess).

Posted: **Sat Feb 24, 2007 7:33 am**

Could you please tell me what kind of greedy algorithm would solve it?

Posted: **Wed Mar 07, 2007 10:08 am**

Sort the workshop by some order (decreasing size, then increasing time).

Sort the rooms by another order (increasing time, then increasing capacity).

Greedily assign each workshop increasing order to the first available room.

Sort the rooms by another order (increasing time, then increasing capacity).

Greedily assign each workshop increasing order to the first available room.

Posted: **Thu Mar 08, 2007 4:38 am**

I thought I could find a counter-example to your greedy choice, but I can't seem to find it at this moment.

Practicing for the world finals I wrote a greedy solution, and I ended up proving to myself that it cannot possibly be greedy (any choice of picking has a counter example). Maybe I didn't think about this choice... I'll go change my ordering to this and see if it works on my test set.

Nate

Practicing for the world finals I wrote a greedy solution, and I ended up proving to myself that it cannot possibly be greedy (any choice of picking has a counter example). Maybe I didn't think about this choice... I'll go change my ordering to this and see if it works on my test set.

Nate

Posted: **Tue Apr 01, 2008 7:12 pm**

edit: can two workshop share the same room at the same time if the room has sufficient capacity