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?

  • + 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 ?

  • + 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 ?

  • + 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?

No more comments