# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
383114 | 2021-03-28T20:32:29 Z | Mastermind | Traffic (IOI10_traffic) | C++17 | 3 ms | 516 KB |
#include "traffic.h" #include <bits/stdc++.h> using namespace std; #define pb push_back int LocateCentre(int N, int pp[], int S[], int D[]) { vector<int> adj[N]; for (int i = 0; i < N; i++) { adj[S[i]].pb(D[i]); adj[D[i]].pb(S[i]); } long long cmin = LLONG_MAX; int cminind = 0; for (int i = 0; i < N; i++) { vector<int> dist(N); vector<bool> vis(N); queue<int> q; q.push(i); while (!q.empty()) { int cur = q.front(); q.pop(); vis[cur] = true; for (int next : adj[cur]) { if (!vis[next]) { q.push(next); dist[next] = dist[cur] + 1; } } } long long tot = 0; for (int i = 0; i < N; i++) { tot += pp[i] * dist[i]; } if (tot < cmin) { cmin = tot; cminind = i; } } cout << cminind << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 516 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 516 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 516 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 516 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |