// #pragma once
#include "gardenlib.h"
#include "garden.h"
#include <vector>
#include <iostream>
using namespace std;
const int N1=1e5;
vector<int> ma[N1];
int in=0;
int fin=-1;
int wnt;
bool vis[N1];
void dfs(int x)
{
vis[x]=1;
if(in==wnt)
fin=x;
for(int y:ma[x])
{
if(!vis[y])
{
in++;
dfs(y);
}
}
in++;
}
void count_routes(int n, int m, int p, int r[][2], int q, int g[])
{
int ans=0;
for(int i=0;i<m;i++)
{
ma[r[i][0]].push_back(r[i][1]);
ma[r[i][1]].push_back(r[i][0]);
}
wnt=g[0];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
vis[j]=0;
in=0;
fin=-1;
dfs(i);
ans+=(fin==p);
}
answer(ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
4680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
4680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
4680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |