11358 - Faster Processing Feasibility

All about problems in Volume 113. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

11358 - Faster Processing Feasibility

Post by sclo »

I tried solving this problem using a greedy method, but get WA. How did other people solved this problem?
My greedy choice is to always process the available jobs with sooner deadlines first.

I now have a feeling that earliest deadline first is not optimal for multiprocessor case. It is optimal only for single processor case.
sohel
Guru
Posts: 856
Joined: Thu Jan 30, 2003 5:50 am
Location: New York

Post by sohel »

The judge solution was written using 'network flow' with (3*T + 2) nodes under consideration.

But there is a greedy solution.
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post by sclo »

I thought that it was NP-hard problem, so greedy doesn't work.
I tried network flow, and it is correct.

This problem is actually almost exactly like 11167 - Monkeys in the Emei Mountain, except the output is easier here. It was decided that greedy was incorrect for that problem, so greedy shouldn't be correct for this problem either.

All it takes to break my greedy method is to use:

Code: Select all

2 3
0 1 1
0 1 2
0 3 3
Earliest deadline will return "NO WAY" but the answer is "FEASIBLE"
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

You base your greedy on earliest deadline, but that's not the correct criterion. My greedy answers "FEASIBLE" for your input. Can't remember all the details of the monkeys problem, but I think greedy is correct for this problem.
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.
Adrian Kuegel
Guru
Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

Post by Adrian Kuegel »

The greedy is actually quite easy: Process those tasks first which have smallest difference "time to deadline" - "remaining processing time needed". I think it should be correct.
shanto86
Experienced poster
Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Post by shanto86 »

i did as adrian said during onsite and got AC :)
Self judging is the best judging!
sclo
Guru
Posts: 519
Joined: Mon Jan 23, 2006 10:45 pm
Location: Vancouver, BC, Canada
Contact:

Post by sclo »

How about this case?

Code: Select all

2 5
0 1 1
2 2 4
2 2 4
0 1 2
0 2 4
According to your greedy: At time 0, you would schedule task 0 and 3. At time 1, only task 4 is available and one of the processor is idle, so the whole schedule is not feasible.
The correct solution is to schedule task 0 and 4 at time 0.
little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm

Post by little joey »

You're right, my greedy gives "NO WAY" :(
The biggest problem with most problems is not how to solve the problem, but how to not solve what is not the problem.
Kraken
New poster
Posts: 1
Joined: Mon Jun 16, 2008 1:03 pm

Re: 11358 - Faster Processing Feasibility

Post by Kraken »

I'm doing max flow using ford-fulkerson and getting TLE because of the fact that i have to clear a 2-dimensional capacity array of size 100 million in each test case.

Is there a better way than having 1 node for each possible time (to decrease number of nodes)?
Post Reply

Return to “Volume 113 (11300-11399)”