Submission #804553

# Submission time Handle Problem Language Result Execution time Memory
804553 2023-08-03T09:46:12 Z Gangsta Tropical Garden (IOI11_garden) C++14
0 / 100
3 ms 4948 KB
// 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;
//}

int count_routes(int n, int m, int p, int r[N][2], int q, int g[2001]){
	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);
		}
		return ans;
		ans = 0;
	}
}

//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);
//}

Compilation message

garden.cpp: In function 'int count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      | ^
# 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 -