#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0),cout.tie(0)
#define ll long long
#define pb push_back
#define F first
#define S second
#define INF 1e18
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pii pair<int,int>
#define pll pair<ll,ll>
#define OK cout<<"Ok"<<endl;
#define MOD (ll)(1e9+7)
#define endl "\n"
const int mxn=2e5+5;
int n,m,k,x,ans;
vector<int>vt[mxn];
void dfs(int u,int cnt,vector<int>&v){
if(cnt==k&&u==x){
ans++;
return;
}
else if(cnt==k){
return;
}
if(v[u]+1>vt[u].size()){
return;
}
v[u]++;
dfs(vt[u][v[u]-1],cnt+1,v);
return;
}
void count_routes(int N, int M, int P, int R[][2], int Q, int G[])
{
n=N,m=M,k=G[0],x=P;
for(int i=0;i<m;i++){
vt[R[i][0]].pb(R[i][1]);
vt[R[i][1]].pb(R[i][0]);
}
for(int i=1;i<=n;i++){
vector<int>v(n+5);
dfs(i-1,0,v);
}
answer(ans);
}
Compilation message
garden.cpp: In function 'void dfs(int, int, std::vector<int>&)':
garden.cpp:29:14: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | if(v[u]+1>vt[u].size()){
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |