| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 409366 | MrFrancho | Traffic (IOI10_traffic) | C++11 | 1119 ms | 170820 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "traffic.h"
using namespace std;
#define pb push_back
using ll = long long;
const int MAXN = 1e6;
vector<int> adj[MAXN], children(MAXN), people(MAXN);
int totalFans = 0;
void DFS(int node, int father, int pp[]) {
for(auto x: adj[node]) {
if(x != father) {
DFS(x,node,pp);
children[node] += children[x];
people[node] = max(people[node], children[x]);
}
}
children[node] += pp[node];
people[node] = max(people[node], totalFans - children[node]);
}
int LocateCentre(int N, int pp[], int S[], int D[]) {
for(int i = 0; i < N; i++) {
totalFans += pp[i];
}
for(int i = 0; i < N-1; i++) {
adj[S[i]].pb(D[i]);
adj[D[i]].pb(S[i]);
}
DFS(0,-1,pp);
int sum = 2e9+1, bestCity;
for(int i = 0; i < N; i++) {
if(people[i] < sum) {
sum = people[i];
bestCity = i;
}
}
return bestCity;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
