Submission #232628

# Submission time Handle Problem Language Result Execution time Memory
232628 2020-05-17T17:32:37 Z crossing0ver Traffic (IOI10_traffic) C++17
0 / 100
167 ms 262148 KB
#include<bits/stdc++.h>
//#include "grader.h"
using namespace std; 
int dp[1000006], C[1000006] , tot; 
vector <int> adj[1000005];
void dfs(int v,int p) {
	dp[v] = 0;
	int s = 0;
	int r = 0;
	for (int i:adj[v]) {
		if (i != v) {
			r++;
			dfs (i,v);
			s += dp[i] + C[i];
			dp[v] = max(dp[v], dp[i] + C[i]);
		}
	}
}

int LocateCentre(int n,int P[],int S[],int D[]) {
	  for (int i = 0; i < n-1; i++)
	  	adj[S[i]].push_back(D[i]),
	  	adj[D[i]].push_back(S[i]),
	  	C[i] = P[i], tot += C[i];
	pair<int,int> ans = {INT_MAX,-1};
	for (int i = 0; i < n; i++) {
		dfs(i,-1);
		ans = min(ans,{dp[i],i});
	}
	return ans.second;
}
# Verdict Execution time Memory Grader output
1 Runtime error 167 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 167 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 167 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 167 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -