// a >> b = a / pow(2,b)
// a << b = a * pow(2,b)
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define sz size()
#define ss second
#define ff first
#define N 200001
#define pii pair<int,int>
using namespace std;
int ans;
vector <pii> adj[N];
void dfs(int nd, int c, int k, int p){
if(c == k){
if(nd == p) ans++;
return;
}
bool a = 0;
if(adj[nd].sz == 1) a = 0;
else a = 1;
dfs(adj[nd][a].ss, c+1, k, p);
}
//int answer(int x){
// return x;
//}
void count_routes(int n, int m, int p, int r[N][2], int q, int g[2001]){
vector <int> answer;
for(int i = 0; i < m; i++){
adj[r[i][0]].pb({i,r[i][1]});
adj[r[i][1]].pb({i,r[i][0]});
}
for(int i = 0; i < n; i++) sort(adj[i].begin(), adj[i].end());
for(int i = 0; i < q; i++){
for(int j = 0; j < n; j++){
dfs(j,0,g[i],p);
}
answer.pb(ans);
ans = 0;
}
for(auto i : answer){
cout << answer[i] << ' ';
}
}
//int main(){
// int n, m, p, r[N][2], q, g[q];
// cin >> n >> m >> p;
// for(int i = 0; i < m; i++) cin >> r[i][0] >> r[i][1];
// cin >> q;
// for(int i = 0; i < q; i++) cin >> g[i];
// count_routes(n,m,p,r,q,g);
//}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |