답안 #917204

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
917204 2024-01-27T12:36:13 Z zyq181 Truck Driver (IOI23_deliveries) C++17
8 / 100
74 ms 10332 KB
#include "deliveries.h"
#include <bits/stdc++.h>
using namespace std;

int N;
vector<pair<int, int> > adjList[1010];
int paredge[1010];
int sbtree[1010];
int tot;
int ans;
int w[1010];

void dfs(int n, int p = -1){
	sbtree[n]+=w[n];
	for(auto it: adjList[n]){
		int x, y;
		x = it.first;
		y = it.second;
		if(x == p) continue;
		paredge[x] = y;
		dfs(x, n);
		sbtree[n] += sbtree[x];
	}
}



void init(int NN, std::vector<int> U, std::vector<int> V, std::vector<int> T, std::vector<int> W) {
	N = NN;
	for(int a=0; a<N-1; a++){
		adjList[U[a]].push_back({V[a], T[a]});
		adjList[V[a]].push_back({U[a], T[a]});
	}
	W[0]++;
	for(int a=0; a<N; a++){
		w[a] = W[a];
		tot += W[a];
	}
	return;
}

long long max_time(int S, int X) {
	for(int a=0; a<N; a++) sbtree[a] = 0;
	ans = 0;
	tot -= w[S];
	w[S] = X;
	if(S == 0) w[0]++;
	tot += w[S];
	dfs(0);
	for(int a=1; a<N; a++){
		if(tot/2 < sbtree[a]){
			ans += 2 * (tot - sbtree[a]) * paredge[a];
		}
		else{
			ans += 2 * sbtree[a] * paredge[a];
		}
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 10324 KB Output is correct
2 Correct 74 ms 10064 KB Output is correct
3 Correct 73 ms 10320 KB Output is correct
4 Correct 73 ms 10332 KB Output is correct
5 Correct 74 ms 10320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 6 ms 476 KB 219th lines differ - on the 1st token, expected: '3813657412', found: '-481309884'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 10324 KB Output is correct
2 Correct 74 ms 10064 KB Output is correct
3 Correct 73 ms 10320 KB Output is correct
4 Correct 73 ms 10332 KB Output is correct
5 Correct 74 ms 10320 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 20 ms 604 KB Output is correct
8 Runtime error 8 ms 1988 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 10324 KB Output is correct
2 Correct 74 ms 10064 KB Output is correct
3 Correct 73 ms 10320 KB Output is correct
4 Correct 73 ms 10332 KB Output is correct
5 Correct 74 ms 10320 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 25 ms 600 KB Output is correct
8 Runtime error 11 ms 1992 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 10324 KB Output is correct
2 Correct 74 ms 10064 KB Output is correct
3 Correct 73 ms 10320 KB Output is correct
4 Correct 73 ms 10332 KB Output is correct
5 Correct 74 ms 10320 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Incorrect 6 ms 476 KB 219th lines differ - on the 1st token, expected: '3813657412', found: '-481309884'
8 Halted 0 ms 0 KB -