Sort by

recency

|

5 Discussions

|

  • + 0 comments

    I'm pretty sure that this question needs to test edge cases better; I came up with a completely naive algorithm that shouldn't work for low k or a disconnected city, but it passed all tests.

  • + 1 comment

    The problem states "Every timestep, each zombie RANDOMLY chooses one of its neighboring junctions and walks towards it.", so, how can the solution be always the same?

    • + 0 comments

      I'm pretty sure it's supposed to be expected value, and "5 most populated junctions" is supposed to be the 5 junctions with highest expected values.

  • + 1 comment

    I can't seem to get my code to run under 2 seconds. Got the right output otherwise. This loop is what's costing me most:

    for (q = 0; q < nb_steps; q++) {
        for (i=0; i<n; i++) {      
            new_numb_zombies[i] = 0;
            for (k = 0; k < nb_adj[i]; k++) {
                w = adj[i][k];
                new_numb_zombies[i] += numb_zombies[w]/nb_adj[w];
            }
        }
        aux = numb_zombies;
        numb_zombies = new_numb_zombies;
        new_numb_zombies = aux;
    }
    

    Any idea on how I could speed this up ?

    • Challenge Author
      + 1 comment

      Clue : principal eigen vector.

      • + 0 comments

        Complication: the distribution won't converge if the graph is bipartite.

  • + 1 comment

    I tested by downloading a failed input and the test case failed saying "Terminated due to timeout" even before completing the task of forming a graph for me to perform manipulations on it ! Any suggestions ?

    • Challenge Author
      + 0 comments

      Clues : Matrix multiplication, principal eigen vectors.

  • + 1 comment

    Can we asume zombies can (when they have enough time) traverse the entire city? In other words is the graph representing the city always connected, or can it consist of mutiple components?

    • Challenge Author
      + 0 comments

      Hi @WardBeullens, no you may not assume that the city is always connected.

No more comments