Submission #866092

# Submission time Handle Problem Language Result Execution time Memory
866092 2023-10-25T11:59:13 Z vjudge1 Closing Time (IOI23_closing) C++17
0 / 100
78 ms 24260 KB
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 3;
vector<pair<int, int>> adj[MAXN];
int dep1[MAXN];
int dep2[MAXN];
void dfs(int node, int par, int dep[]){
	for (auto [to, w] : adj[node]){
		if (to == par) continue;
		dep[to] = dep[node] + w;
	}
}
int max_score(int N, int X, int Y, long long K, vector<int> U, vector<int> V, vector<int> W)
{
	for (int i = 0; i < N - 1; i++){
		adj[U[i]].push_back({V[i], W[i]});
		adj[V[i]].push_back({U[i], W[i]});
	}
	dfs(X, -1, dep1);
	dfs(Y, -1, dep2);
	priority_queue<int, vector<int>, greater<int>> pq;
	for (int i = 0; i < N-1; i++){
		pq.push(dep1[i]);
		pq.push(dep2[i]);
	}
	int ans = 0;
	while (!pq.empty() && pq.top() <= K){
		K -= pq.top();
		pq.pop();
		ans++;
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6744 KB 1st lines differ - on the 1st token, expected: '6', found: '10'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 78 ms 24260 KB 1st lines differ - on the 1st token, expected: '451', found: '399998'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Incorrect 2 ms 6656 KB 1st lines differ - on the 1st token, expected: '30', found: '38'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Incorrect 2 ms 6656 KB 1st lines differ - on the 1st token, expected: '30', found: '38'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Incorrect 2 ms 6656 KB 1st lines differ - on the 1st token, expected: '30', found: '38'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6744 KB 1st lines differ - on the 1st token, expected: '6', found: '10'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6744 KB 1st lines differ - on the 1st token, expected: '6', found: '10'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6744 KB 1st lines differ - on the 1st token, expected: '6', found: '10'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6744 KB 1st lines differ - on the 1st token, expected: '6', found: '10'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 6744 KB 1st lines differ - on the 1st token, expected: '6', found: '10'
2 Halted 0 ms 0 KB -