Submission #68119

# Submission time Handle Problem Language Result Execution time Memory
68119 2018-08-16T02:15:30 Z KieranHorgan Crocodile's Underground City (IOI11_crocodile) C++17
46 / 100
9 ms 3360 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;

int k;
vector<pair<int, int>> AdjList[100005];
bitset<100005> visited;
int p[100005];
int dfs(int u) {
	if(p[u]) return 0;
	visited[u] = 1;
	vector<int> pos = {1<<30, 1<<30};
	for(auto v: AdjList[u])
		if(!visited[v.second])
			pos.push_back(dfs(v.second)+v.first);
	sort(pos.begin(), pos.end());
	return pos[1];
}

int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) {
	k = K;
	for(int i = 0; i < K; i++)
		p[P[i]]=1;
	for(int i = 0; i < M; i++) {
		AdjList[R[i][0]].push_back({L[i], R[i][1]});
		AdjList[R[i][1]].push_back({L[i], R[i][0]});
	}

	return dfs(0);
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2724 KB Output is correct
4 Correct 6 ms 2920 KB Output is correct
5 Correct 6 ms 3108 KB Output is correct
6 Correct 6 ms 3128 KB Output is correct
7 Correct 6 ms 3140 KB Output is correct
8 Correct 6 ms 3216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2724 KB Output is correct
4 Correct 6 ms 2920 KB Output is correct
5 Correct 6 ms 3108 KB Output is correct
6 Correct 6 ms 3128 KB Output is correct
7 Correct 6 ms 3140 KB Output is correct
8 Correct 6 ms 3216 KB Output is correct
9 Incorrect 9 ms 3360 KB Output isn't correct
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2724 KB Output is correct
4 Correct 6 ms 2920 KB Output is correct
5 Correct 6 ms 3108 KB Output is correct
6 Correct 6 ms 3128 KB Output is correct
7 Correct 6 ms 3140 KB Output is correct
8 Correct 6 ms 3216 KB Output is correct
9 Incorrect 9 ms 3360 KB Output isn't correct
10 Halted 0 ms 0 KB -