Submission #592483

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

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

void dfs(int v, int par, int cnt, int P)
{
    if(!cnt)
    {
        if(v==P) ans++;
        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<q; i++)
    {
        ans=0;
        for(int j=0; j<n; j++)
        {
            dfs(j, -1, G[i], P);
        }
        answer(ans);
    }
}


# Verdict Execution time Memory Grader output
1 Correct 2 ms 3796 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
4 Correct 2 ms 3796 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3796 KB Output is correct
7 Correct 3 ms 3796 KB Output is correct
8 Correct 3 ms 3884 KB Output is correct
9 Correct 5 ms 4052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3796 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
4 Correct 2 ms 3796 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3796 KB Output is correct
7 Correct 3 ms 3796 KB Output is correct
8 Correct 3 ms 3884 KB Output is correct
9 Correct 5 ms 4052 KB Output is correct
10 Correct 6 ms 3796 KB Output is correct
11 Execution timed out 5009 ms 4692 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3796 KB Output is correct
2 Correct 2 ms 3796 KB Output is correct
3 Correct 3 ms 3796 KB Output is correct
4 Correct 2 ms 3796 KB Output is correct
5 Correct 2 ms 3796 KB Output is correct
6 Correct 3 ms 3796 KB Output is correct
7 Correct 3 ms 3796 KB Output is correct
8 Correct 3 ms 3884 KB Output is correct
9 Correct 5 ms 4052 KB Output is correct
10 Correct 6 ms 3796 KB Output is correct
11 Execution timed out 5009 ms 4692 KB Time limit exceeded
12 Halted 0 ms 0 KB -