Submission #592462

# Submission time Handle Problem Language Result Execution time Memory
592462 2022-07-09T08:37:07 Z BT21tata Tropical Garden (IOI11_garden) C++17
0 / 100
4 ms 3924 KB
#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>
using namespace std;

vector<int>g[150005];
map<int,int>mp;

void dfs(int v, int par, int cnt, int P)
{
    if(v==P)
    {
        mp[cnt]++;
        return;
    }
    if(g[v].size()==1 or g[v][0]!=par)
        dfs(g[v][0], v, cnt+1, P);
    else dfs(g[v][1], v, cnt+1, P);
}

void count_routes(int n, int m, int P, int r[][2], int q, int G[])
{
    for(int i=0; i<m; i++)
    {
        g[r[i][0]].push_back(r[i][1]);
        g[r[i][1]].push_back(r[i][0]);
    }
    for(int i=0; i<n; i++)
        dfs(i, -1, 0, P);

    for(int i=0; i<q; i++)
        answer(mp[G[i]]);
}


# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 3924 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 3924 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 3924 KB Output isn't correct
2 Halted 0 ms 0 KB -