#include "garden.h"
#include "gardenlib.h"
#include <iostream>
using namespace std;
long long int ans,n,m,p,map[1005][1005],tag[10005],ta;
int find(int x,int pe)
{
if(pe==ta)
{
if(x==p)ans++;
return 0;
}
int tmp=0,now=-1;
for(int i=0;i<n;i++)
{
if(map[x][i]!=-1)
{
if(now==-1)
{
if(tag[map[x][i]]==1)tmp=n;
else tmp=map[x][i];
now=i;
}
else if(map[x][i]<tmp && tag[map[x][i]]==0)
{
now=i;
tmp=map[x][i];
}
}
}
tag[tmp]=1;
find(now,pe+1);
}
void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
n=N,m=M,p=P,ta=G[0];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)map[i][j]=-1;
}
for(int i=0;i<m;i++)
{
map[R[i][0]][R[i][1]]=i;
map[R[i][1]][R[i][0]]=i;
}
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)tag[j]=0;
find(i,0);
}
answer(ans);
}
Compilation message
garden.cpp: In function 'int find(int, int)':
garden.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
6528 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
6528 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
43 ms |
6528 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |