제출 #804590

#제출 시각아이디문제언어결과실행 시간메모리
804590Gangsta열대 식물원 (Tropical Garden) (IOI11_garden)C++14
0 / 100
7 ms9960 KiB
// 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;
//}

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

컴파일 시 표준 에러 (stderr) 메시지

garden.cpp: In function 'std::vector<int> count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:50:1: warning: no return statement in function returning non-void [-Wreturn-type]
   50 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...