답안 #414874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
414874 2021-05-31T09:53:23 Z JediMaster11 Traffic (IOI10_traffic) C++17
50 / 100
5000 ms 27328 KB
#include <bits/stdc++.h>
#include "traffic.h"
using namespace std;
 
 
#define ll long long
#define uint unsigned int
#define ull unsigned long long
#define endl "\n"
#define elif else if
#define fo(i, a, b) for (int i = a; i < (int)b; i++)
#define rfo(i, a, b) for (int i = a - 1; i >= b; i--)
#define v(i) vector<i>
#define vll vector<long long>
#define vstr vector<string>
#define pairll pair<long long, long long>
#define vpairll vector<pair<long long, long long>>
#define print(x) cout << x << "\n"
 
#define pushall(x, n)                   \
    x.resize(n);                        \
    for (int zz = 0; zz < (int)n; zz++) \
    {                                   \
        cin >> x[zz];                   \
    }
 
 
 
 
const int MAX_N = 1e6 + 3e2;
vector<int> adj[MAX_N];
 
int dfss(int u, int p, int P[]) {
    int ans = P[u];
    for(int to : adj[u]) {
        if(to == p) continue;
        ans += dfss(to, u, P);
    }
    return ans;
}
 
int LocateCentre(int Nn, int Ps[], int S[], int D[]) {
  	int N = Nn;
    for(int i = 0; i < N-1; i++) {
        adj[S[i]].push_back(D[i]);
        adj[D[i]].push_back(S[i]);
    }
 
    int ans = 2147483647, ret = -1;
    for(int i = 0; i < N; i++) {
        int max_traffic = -2147483648;
        for(int to : adj[i]) {
            max_traffic = max(max_traffic, dfss(to, i, Ps));
        }
        if(max_traffic < ans) {
            ans = max_traffic;
            ret = i;
        }
    }
    return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 23756 KB Output is correct
2 Correct 14 ms 23756 KB Output is correct
3 Correct 14 ms 23756 KB Output is correct
4 Correct 14 ms 23756 KB Output is correct
5 Correct 15 ms 23808 KB Output is correct
6 Correct 14 ms 23740 KB Output is correct
7 Correct 15 ms 23756 KB Output is correct
8 Correct 14 ms 23756 KB Output is correct
9 Correct 14 ms 23700 KB Output is correct
10 Correct 14 ms 23688 KB Output is correct
11 Correct 14 ms 23752 KB Output is correct
12 Correct 14 ms 23808 KB Output is correct
13 Correct 14 ms 23696 KB Output is correct
14 Correct 14 ms 23692 KB Output is correct
15 Correct 14 ms 23756 KB Output is correct
16 Correct 14 ms 23756 KB Output is correct
17 Correct 15 ms 23756 KB Output is correct
18 Correct 14 ms 23740 KB Output is correct
19 Correct 14 ms 23884 KB Output is correct
20 Correct 14 ms 23756 KB Output is correct
21 Correct 14 ms 23756 KB Output is correct
22 Correct 15 ms 23812 KB Output is correct
23 Correct 14 ms 23720 KB Output is correct
24 Correct 14 ms 23756 KB Output is correct
25 Correct 14 ms 23736 KB Output is correct
26 Correct 14 ms 23708 KB Output is correct
27 Correct 15 ms 23700 KB Output is correct
28 Correct 19 ms 23756 KB Output is correct
29 Correct 18 ms 23756 KB Output is correct
30 Correct 16 ms 23716 KB Output is correct
31 Correct 17 ms 23832 KB Output is correct
32 Correct 17 ms 23744 KB Output is correct
33 Correct 17 ms 23756 KB Output is correct
34 Correct 14 ms 23716 KB Output is correct
35 Correct 18 ms 23732 KB Output is correct
36 Correct 19 ms 23756 KB Output is correct
37 Correct 22 ms 23756 KB Output is correct
38 Correct 20 ms 23796 KB Output is correct
39 Correct 25 ms 23844 KB Output is correct
40 Correct 25 ms 23832 KB Output is correct
41 Correct 24 ms 23864 KB Output is correct
42 Correct 25 ms 23756 KB Output is correct
43 Correct 14 ms 23756 KB Output is correct
44 Correct 14 ms 23712 KB Output is correct
45 Correct 14 ms 23804 KB Output is correct
46 Correct 14 ms 23804 KB Output is correct
47 Correct 15 ms 23808 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 23756 KB Output is correct
2 Correct 14 ms 23756 KB Output is correct
3 Correct 14 ms 23756 KB Output is correct
4 Correct 14 ms 23756 KB Output is correct
5 Correct 15 ms 23808 KB Output is correct
6 Correct 14 ms 23740 KB Output is correct
7 Correct 15 ms 23756 KB Output is correct
8 Correct 14 ms 23756 KB Output is correct
9 Correct 14 ms 23700 KB Output is correct
10 Correct 14 ms 23688 KB Output is correct
11 Correct 14 ms 23752 KB Output is correct
12 Correct 14 ms 23808 KB Output is correct
13 Correct 14 ms 23696 KB Output is correct
14 Correct 14 ms 23692 KB Output is correct
15 Correct 14 ms 23756 KB Output is correct
16 Correct 14 ms 23756 KB Output is correct
17 Correct 15 ms 23756 KB Output is correct
18 Correct 14 ms 23740 KB Output is correct
19 Correct 14 ms 23884 KB Output is correct
20 Correct 14 ms 23756 KB Output is correct
21 Correct 14 ms 23756 KB Output is correct
22 Correct 15 ms 23812 KB Output is correct
23 Correct 14 ms 23720 KB Output is correct
24 Correct 14 ms 23756 KB Output is correct
25 Correct 14 ms 23736 KB Output is correct
26 Correct 14 ms 23708 KB Output is correct
27 Correct 15 ms 23700 KB Output is correct
28 Correct 19 ms 23756 KB Output is correct
29 Correct 18 ms 23756 KB Output is correct
30 Correct 16 ms 23716 KB Output is correct
31 Correct 17 ms 23832 KB Output is correct
32 Correct 17 ms 23744 KB Output is correct
33 Correct 17 ms 23756 KB Output is correct
34 Correct 14 ms 23716 KB Output is correct
35 Correct 18 ms 23732 KB Output is correct
36 Correct 19 ms 23756 KB Output is correct
37 Correct 22 ms 23756 KB Output is correct
38 Correct 20 ms 23796 KB Output is correct
39 Correct 25 ms 23844 KB Output is correct
40 Correct 25 ms 23832 KB Output is correct
41 Correct 24 ms 23864 KB Output is correct
42 Correct 25 ms 23756 KB Output is correct
43 Correct 14 ms 23756 KB Output is correct
44 Correct 14 ms 23712 KB Output is correct
45 Correct 14 ms 23804 KB Output is correct
46 Correct 14 ms 23804 KB Output is correct
47 Correct 15 ms 23808 KB Output is correct
48 Correct 13 ms 23808 KB Output is correct
49 Correct 14 ms 23812 KB Output is correct
50 Correct 15 ms 23756 KB Output is correct
51 Correct 14 ms 23720 KB Output is correct
52 Correct 14 ms 23788 KB Output is correct
53 Correct 14 ms 23712 KB Output is correct
54 Correct 14 ms 23800 KB Output is correct
55 Correct 14 ms 23684 KB Output is correct
56 Correct 14 ms 23776 KB Output is correct
57 Correct 14 ms 23756 KB Output is correct
58 Correct 14 ms 23756 KB Output is correct
59 Correct 14 ms 23756 KB Output is correct
60 Correct 14 ms 23780 KB Output is correct
61 Correct 14 ms 23696 KB Output is correct
62 Correct 17 ms 23756 KB Output is correct
63 Correct 16 ms 23756 KB Output is correct
64 Correct 17 ms 23756 KB Output is correct
65 Correct 14 ms 23756 KB Output is correct
66 Correct 14 ms 23780 KB Output is correct
67 Correct 14 ms 23756 KB Output is correct
68 Execution timed out 5036 ms 27328 KB Time limit exceeded
69 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 23756 KB Output is correct
2 Correct 14 ms 23756 KB Output is correct
3 Correct 14 ms 23756 KB Output is correct
4 Correct 14 ms 23756 KB Output is correct
5 Correct 15 ms 23808 KB Output is correct
6 Correct 14 ms 23740 KB Output is correct
7 Correct 15 ms 23756 KB Output is correct
8 Correct 14 ms 23756 KB Output is correct
9 Correct 14 ms 23700 KB Output is correct
10 Correct 14 ms 23688 KB Output is correct
11 Correct 14 ms 23752 KB Output is correct
12 Correct 14 ms 23808 KB Output is correct
13 Correct 14 ms 23696 KB Output is correct
14 Correct 14 ms 23692 KB Output is correct
15 Correct 14 ms 23756 KB Output is correct
16 Correct 14 ms 23756 KB Output is correct
17 Correct 15 ms 23756 KB Output is correct
18 Correct 14 ms 23740 KB Output is correct
19 Correct 14 ms 23884 KB Output is correct
20 Correct 14 ms 23756 KB Output is correct
21 Correct 14 ms 23756 KB Output is correct
22 Correct 15 ms 23812 KB Output is correct
23 Correct 14 ms 23720 KB Output is correct
24 Correct 14 ms 23756 KB Output is correct
25 Correct 14 ms 23736 KB Output is correct
26 Correct 14 ms 23708 KB Output is correct
27 Correct 15 ms 23700 KB Output is correct
28 Correct 19 ms 23756 KB Output is correct
29 Correct 18 ms 23756 KB Output is correct
30 Correct 16 ms 23716 KB Output is correct
31 Correct 17 ms 23832 KB Output is correct
32 Correct 17 ms 23744 KB Output is correct
33 Correct 17 ms 23756 KB Output is correct
34 Correct 14 ms 23716 KB Output is correct
35 Correct 18 ms 23732 KB Output is correct
36 Correct 19 ms 23756 KB Output is correct
37 Correct 22 ms 23756 KB Output is correct
38 Correct 20 ms 23796 KB Output is correct
39 Correct 25 ms 23844 KB Output is correct
40 Correct 25 ms 23832 KB Output is correct
41 Correct 24 ms 23864 KB Output is correct
42 Correct 25 ms 23756 KB Output is correct
43 Correct 14 ms 23756 KB Output is correct
44 Correct 14 ms 23712 KB Output is correct
45 Correct 14 ms 23804 KB Output is correct
46 Correct 14 ms 23804 KB Output is correct
47 Correct 15 ms 23808 KB Output is correct
48 Correct 14 ms 23808 KB Output is correct
49 Correct 14 ms 23756 KB Output is correct
50 Correct 15 ms 23708 KB Output is correct
51 Correct 17 ms 23688 KB Output is correct
52 Correct 16 ms 23692 KB Output is correct
53 Correct 14 ms 23756 KB Output is correct
54 Correct 14 ms 23776 KB Output is correct
55 Correct 14 ms 23808 KB Output is correct
56 Correct 14 ms 23708 KB Output is correct
57 Correct 14 ms 23728 KB Output is correct
58 Correct 14 ms 23796 KB Output is correct
59 Correct 14 ms 23732 KB Output is correct
60 Correct 14 ms 23736 KB Output is correct
61 Correct 17 ms 23756 KB Output is correct
62 Correct 14 ms 23756 KB Output is correct
63 Correct 14 ms 23756 KB Output is correct
64 Correct 14 ms 23788 KB Output is correct
65 Correct 14 ms 23804 KB Output is correct
66 Correct 15 ms 23804 KB Output is correct
67 Correct 14 ms 23720 KB Output is correct
68 Correct 14 ms 23756 KB Output is correct
69 Correct 14 ms 23756 KB Output is correct
70 Correct 14 ms 23808 KB Output is correct
71 Correct 14 ms 23728 KB Output is correct
72 Correct 14 ms 23808 KB Output is correct
73 Correct 15 ms 23756 KB Output is correct
74 Correct 15 ms 23804 KB Output is correct
75 Correct 15 ms 23756 KB Output is correct
76 Correct 16 ms 23808 KB Output is correct
77 Correct 15 ms 23740 KB Output is correct
78 Correct 16 ms 23820 KB Output is correct
79 Correct 16 ms 23756 KB Output is correct
80 Correct 18 ms 23784 KB Output is correct
81 Correct 14 ms 23704 KB Output is correct
82 Correct 18 ms 23804 KB Output is correct
83 Correct 19 ms 23756 KB Output is correct
84 Correct 20 ms 23820 KB Output is correct
85 Correct 22 ms 23808 KB Output is correct
86 Correct 25 ms 23772 KB Output is correct
87 Correct 28 ms 23728 KB Output is correct
88 Correct 28 ms 23824 KB Output is correct
89 Correct 29 ms 23756 KB Output is correct
90 Correct 31 ms 23832 KB Output is correct
91 Correct 42 ms 23836 KB Output is correct
92 Correct 15 ms 23808 KB Output is correct
93 Correct 40 ms 23756 KB Output is correct
94 Correct 17 ms 23756 KB Output is correct
95 Correct 29 ms 23864 KB Output is correct
96 Correct 14 ms 23864 KB Output is correct
97 Correct 16 ms 23756 KB Output is correct
98 Correct 15 ms 23764 KB Output is correct
99 Correct 14 ms 23804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 23756 KB Output is correct
2 Correct 14 ms 23756 KB Output is correct
3 Correct 14 ms 23756 KB Output is correct
4 Correct 14 ms 23756 KB Output is correct
5 Correct 15 ms 23808 KB Output is correct
6 Correct 14 ms 23740 KB Output is correct
7 Correct 15 ms 23756 KB Output is correct
8 Correct 14 ms 23756 KB Output is correct
9 Correct 14 ms 23700 KB Output is correct
10 Correct 14 ms 23688 KB Output is correct
11 Correct 14 ms 23752 KB Output is correct
12 Correct 14 ms 23808 KB Output is correct
13 Correct 14 ms 23696 KB Output is correct
14 Correct 14 ms 23692 KB Output is correct
15 Correct 14 ms 23756 KB Output is correct
16 Correct 14 ms 23756 KB Output is correct
17 Correct 15 ms 23756 KB Output is correct
18 Correct 14 ms 23740 KB Output is correct
19 Correct 14 ms 23884 KB Output is correct
20 Correct 14 ms 23756 KB Output is correct
21 Correct 14 ms 23756 KB Output is correct
22 Correct 15 ms 23812 KB Output is correct
23 Correct 14 ms 23720 KB Output is correct
24 Correct 14 ms 23756 KB Output is correct
25 Correct 14 ms 23736 KB Output is correct
26 Correct 14 ms 23708 KB Output is correct
27 Correct 15 ms 23700 KB Output is correct
28 Correct 19 ms 23756 KB Output is correct
29 Correct 18 ms 23756 KB Output is correct
30 Correct 16 ms 23716 KB Output is correct
31 Correct 17 ms 23832 KB Output is correct
32 Correct 17 ms 23744 KB Output is correct
33 Correct 17 ms 23756 KB Output is correct
34 Correct 14 ms 23716 KB Output is correct
35 Correct 18 ms 23732 KB Output is correct
36 Correct 19 ms 23756 KB Output is correct
37 Correct 22 ms 23756 KB Output is correct
38 Correct 20 ms 23796 KB Output is correct
39 Correct 25 ms 23844 KB Output is correct
40 Correct 25 ms 23832 KB Output is correct
41 Correct 24 ms 23864 KB Output is correct
42 Correct 25 ms 23756 KB Output is correct
43 Correct 14 ms 23756 KB Output is correct
44 Correct 14 ms 23712 KB Output is correct
45 Correct 14 ms 23804 KB Output is correct
46 Correct 14 ms 23804 KB Output is correct
47 Correct 15 ms 23808 KB Output is correct
48 Correct 13 ms 23808 KB Output is correct
49 Correct 14 ms 23812 KB Output is correct
50 Correct 15 ms 23756 KB Output is correct
51 Correct 14 ms 23720 KB Output is correct
52 Correct 14 ms 23788 KB Output is correct
53 Correct 14 ms 23712 KB Output is correct
54 Correct 14 ms 23800 KB Output is correct
55 Correct 14 ms 23684 KB Output is correct
56 Correct 14 ms 23776 KB Output is correct
57 Correct 14 ms 23756 KB Output is correct
58 Correct 14 ms 23756 KB Output is correct
59 Correct 14 ms 23756 KB Output is correct
60 Correct 14 ms 23780 KB Output is correct
61 Correct 14 ms 23696 KB Output is correct
62 Correct 17 ms 23756 KB Output is correct
63 Correct 16 ms 23756 KB Output is correct
64 Correct 17 ms 23756 KB Output is correct
65 Correct 14 ms 23756 KB Output is correct
66 Correct 14 ms 23780 KB Output is correct
67 Correct 14 ms 23756 KB Output is correct
68 Execution timed out 5036 ms 27328 KB Time limit exceeded
69 Halted 0 ms 0 KB -