Mostrar mensagens com a etiqueta network flow. Mostrar todas as mensagens
Mostrar mensagens com a etiqueta network flow. Mostrar todas as mensagens

domingo, 28 de dezembro de 2014

CodeChef December Long Challenge - Problem Course Selection

In the beginning of the month, I enjoyed participating in CodeChef's December Long Challenge. I was pretty proud to get 33rd place out of 5726 contestants.

The hardest challenge was the problem Course Selection.

We want to attend N courses over M semesters. There are K course prerequisites (a, b) - we must take course a before b. We're also given a matrix X where X[i][j] is the grade (0..100) obtained if we take course i at semester j or -1 if we can't take the course in that semester.
What is the maximum average grade we can obtain?

It is guaranteed it is possible to take the N courses. Constraints:
  • 0 <= N, M, K <= 100
  • -1 <= X[i][j] <= 100  
For 20% of the points, a course has at most one prerequisite.