답안 #866103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
866103 2023-10-25T12:15:44 Z vjudge1 봉쇄 시간 (IOI23_closing) C++17
8 / 100
101 ms 38560 KB
#include "closing.h"
#include <bits/stdc++.h>
using namespace std;
namespace{
	const int MAXN = 2e5 + 3;
	vector<pair<int, int>> adj[MAXN];
	long long dep1[MAXN];
	long long dep2[MAXN];
	void dfs(int node, int par, long long dep[]){
		for (auto [to, w] : adj[node]){
			if (to == par) continue;
			dep[to] = dep[node] + w;
			dfs(to, node, dep);
		}
	}
}
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<long long, vector<long long>, greater<long long>> pq;
	for (int i = 0; i < N; i++){
		pq.push(dep1[i]);
		pq.push(dep2[i]);
	}
	int ans = 0;
	while (!pq.empty() && pq.top() <= K){
		K -= pq.top();
		pq.pop();
		ans++;
	}
	for (int i = 0; i < N; i++){
		adj[i].clear();
		dep1[i] = dep2[i] = 0;
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 90 ms 28872 KB Output is correct
2 Correct 101 ms 38560 KB Output is correct
3 Correct 54 ms 11088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5980 KB Output is correct
2 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5980 KB Output is correct
2 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 5980 KB Output is correct
2 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '30', found: '24'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 5980 KB 1st lines differ - on the 1st token, expected: '6', found: '5'
2 Halted 0 ms 0 KB -