12
cb219
6y

well fuck me, just spent the whole weekend (about 33 hrs) not being able to solve a task from uni with a java program we had to write🙄😪

the problem was a given set of movies with a weekday, the begin time, the duration, the title, and a "score"
the movies take place in one week (random days, random amount of movies) and every movie can be shown multiple times
our task was to find a sequence of non-overlapping (all unique) movies with a score of at least a given number
all in text form

i tried dynamic programming but the more i tried, the more it got complicated, so i ended up using "earliest finishing time first"
my code is just 3 points under the goal and i don't know what to change anymore😒, also some friends did the exact same and succeeded somehow
copying (and obfuscating) won't work, as the codes will be compared by a very good "copy checker"
let's hope i'll still have a chance for an exam😐

Comments
  • 1
    @Automated code checking is stupid. In our uni our prof checks it.
  • 1
    Build a graph out of it, connecting past movies to future movies that do not overlap. Then apply https://en.wikipedia.org/wiki/... to it, should give you the best path. I also suggest writing some pruning rules instead of just using a naively generate graph (to speed up search).

    If you have a time limit which you cannot have your program exceed and dij.. is not enough. i suggest hierarchical path finding. However that is not optimal.
Add Comment