#include <iostream>
#include <numeric>
#include <vector>
#include <algorithm>
#define int long long
using namespace std;
vector<int> adj[200005];
int S[200005];
int N, M, Q;
signed main()
{
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
cin >> N >> M >> Q;
for (int i = 1; i <= N; i++) cin >> S[i];
for (int i = 0; i < M; i++) {
int u, v; cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
int ans = 0;
for (int i = 1; i <= N; i++) {
ans += ((int)adj[i].size() - 1) * S[i];
}
cout << ans + *max_element(S+1, S+N+1) << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
55 ms |
12712 KB |
Output is correct |
3 |
Correct |
50 ms |
12748 KB |
Output is correct |
4 |
Correct |
49 ms |
12720 KB |
Output is correct |
5 |
Correct |
53 ms |
12824 KB |
Output is correct |
6 |
Correct |
50 ms |
12752 KB |
Output is correct |
7 |
Correct |
50 ms |
12760 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
55 ms |
12712 KB |
Output is correct |
3 |
Correct |
50 ms |
12748 KB |
Output is correct |
4 |
Correct |
49 ms |
12720 KB |
Output is correct |
5 |
Correct |
53 ms |
12824 KB |
Output is correct |
6 |
Correct |
50 ms |
12752 KB |
Output is correct |
7 |
Correct |
50 ms |
12760 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
57 ms |
12800 KB |
Output is correct |
11 |
Correct |
57 ms |
12748 KB |
Output is correct |
12 |
Correct |
57 ms |
12752 KB |
Output is correct |
13 |
Correct |
57 ms |
12764 KB |
Output is correct |
14 |
Correct |
56 ms |
12784 KB |
Output is correct |
15 |
Correct |
57 ms |
12780 KB |
Output is correct |
16 |
Correct |
62 ms |
12820 KB |
Output is correct |
17 |
Correct |
56 ms |
12816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
55 ms |
12712 KB |
Output is correct |
3 |
Correct |
50 ms |
12748 KB |
Output is correct |
4 |
Correct |
49 ms |
12720 KB |
Output is correct |
5 |
Correct |
53 ms |
12824 KB |
Output is correct |
6 |
Correct |
50 ms |
12752 KB |
Output is correct |
7 |
Correct |
50 ms |
12760 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
57 ms |
12800 KB |
Output is correct |
11 |
Correct |
57 ms |
12748 KB |
Output is correct |
12 |
Correct |
57 ms |
12752 KB |
Output is correct |
13 |
Correct |
57 ms |
12764 KB |
Output is correct |
14 |
Correct |
56 ms |
12784 KB |
Output is correct |
15 |
Correct |
57 ms |
12780 KB |
Output is correct |
16 |
Correct |
62 ms |
12820 KB |
Output is correct |
17 |
Correct |
56 ms |
12816 KB |
Output is correct |
18 |
Correct |
2 ms |
4948 KB |
Output is correct |
19 |
Correct |
94 ms |
13892 KB |
Output is correct |
20 |
Correct |
89 ms |
13856 KB |
Output is correct |
21 |
Correct |
72 ms |
13800 KB |
Output is correct |
22 |
Correct |
79 ms |
13980 KB |
Output is correct |
23 |
Correct |
82 ms |
14540 KB |
Output is correct |
24 |
Correct |
66 ms |
14844 KB |
Output is correct |
25 |
Correct |
60 ms |
14368 KB |
Output is correct |
26 |
Correct |
63 ms |
14400 KB |
Output is correct |
27 |
Correct |
71 ms |
14324 KB |
Output is correct |
28 |
Correct |
72 ms |
13036 KB |
Output is correct |
29 |
Correct |
71 ms |
13436 KB |
Output is correct |
30 |
Correct |
69 ms |
14080 KB |
Output is correct |
31 |
Correct |
63 ms |
14340 KB |
Output is correct |
32 |
Correct |
70 ms |
14376 KB |
Output is correct |
33 |
Correct |
72 ms |
15060 KB |
Output is correct |
34 |
Correct |
79 ms |
13948 KB |
Output is correct |
35 |
Correct |
76 ms |
14920 KB |
Output is correct |
36 |
Correct |
70 ms |
14912 KB |
Output is correct |
37 |
Correct |
72 ms |
14912 KB |
Output is correct |
38 |
Correct |
78 ms |
14536 KB |
Output is correct |
39 |
Correct |
69 ms |
13516 KB |
Output is correct |
40 |
Correct |
88 ms |
14072 KB |
Output is correct |
41 |
Correct |
67 ms |
12760 KB |
Output is correct |
42 |
Correct |
65 ms |
12788 KB |
Output is correct |
43 |
Correct |
78 ms |
14032 KB |
Output is correct |
44 |
Correct |
72 ms |
14020 KB |
Output is correct |
45 |
Correct |
72 ms |
14048 KB |
Output is correct |
46 |
Correct |
75 ms |
13964 KB |
Output is correct |
47 |
Correct |
80 ms |
14020 KB |
Output is correct |
48 |
Correct |
95 ms |
14036 KB |
Output is correct |
49 |
Correct |
71 ms |
14012 KB |
Output is correct |
50 |
Correct |
91 ms |
13988 KB |
Output is correct |
51 |
Correct |
82 ms |
14048 KB |
Output is correct |
52 |
Correct |
65 ms |
13920 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
55 ms |
12712 KB |
Output is correct |
3 |
Correct |
50 ms |
12748 KB |
Output is correct |
4 |
Correct |
49 ms |
12720 KB |
Output is correct |
5 |
Correct |
53 ms |
12824 KB |
Output is correct |
6 |
Correct |
50 ms |
12752 KB |
Output is correct |
7 |
Correct |
50 ms |
12760 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
57 ms |
12800 KB |
Output is correct |
11 |
Correct |
57 ms |
12748 KB |
Output is correct |
12 |
Correct |
57 ms |
12752 KB |
Output is correct |
13 |
Correct |
57 ms |
12764 KB |
Output is correct |
14 |
Correct |
56 ms |
12784 KB |
Output is correct |
15 |
Correct |
57 ms |
12780 KB |
Output is correct |
16 |
Correct |
62 ms |
12820 KB |
Output is correct |
17 |
Correct |
56 ms |
12816 KB |
Output is correct |
18 |
Correct |
2 ms |
4948 KB |
Output is correct |
19 |
Correct |
94 ms |
13892 KB |
Output is correct |
20 |
Correct |
89 ms |
13856 KB |
Output is correct |
21 |
Correct |
72 ms |
13800 KB |
Output is correct |
22 |
Correct |
79 ms |
13980 KB |
Output is correct |
23 |
Correct |
82 ms |
14540 KB |
Output is correct |
24 |
Correct |
66 ms |
14844 KB |
Output is correct |
25 |
Correct |
60 ms |
14368 KB |
Output is correct |
26 |
Correct |
63 ms |
14400 KB |
Output is correct |
27 |
Correct |
71 ms |
14324 KB |
Output is correct |
28 |
Correct |
72 ms |
13036 KB |
Output is correct |
29 |
Correct |
71 ms |
13436 KB |
Output is correct |
30 |
Correct |
69 ms |
14080 KB |
Output is correct |
31 |
Correct |
63 ms |
14340 KB |
Output is correct |
32 |
Correct |
70 ms |
14376 KB |
Output is correct |
33 |
Correct |
72 ms |
15060 KB |
Output is correct |
34 |
Correct |
79 ms |
13948 KB |
Output is correct |
35 |
Correct |
76 ms |
14920 KB |
Output is correct |
36 |
Correct |
70 ms |
14912 KB |
Output is correct |
37 |
Correct |
72 ms |
14912 KB |
Output is correct |
38 |
Correct |
78 ms |
14536 KB |
Output is correct |
39 |
Correct |
69 ms |
13516 KB |
Output is correct |
40 |
Correct |
88 ms |
14072 KB |
Output is correct |
41 |
Correct |
67 ms |
12760 KB |
Output is correct |
42 |
Correct |
65 ms |
12788 KB |
Output is correct |
43 |
Correct |
78 ms |
14032 KB |
Output is correct |
44 |
Correct |
72 ms |
14020 KB |
Output is correct |
45 |
Correct |
72 ms |
14048 KB |
Output is correct |
46 |
Correct |
75 ms |
13964 KB |
Output is correct |
47 |
Correct |
80 ms |
14020 KB |
Output is correct |
48 |
Correct |
95 ms |
14036 KB |
Output is correct |
49 |
Correct |
71 ms |
14012 KB |
Output is correct |
50 |
Correct |
91 ms |
13988 KB |
Output is correct |
51 |
Correct |
82 ms |
14048 KB |
Output is correct |
52 |
Correct |
65 ms |
13920 KB |
Output is correct |
53 |
Incorrect |
2 ms |
4948 KB |
Output isn't correct |
54 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Incorrect |
2 ms |
4948 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Incorrect |
2 ms |
4948 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
55 ms |
12712 KB |
Output is correct |
3 |
Correct |
50 ms |
12748 KB |
Output is correct |
4 |
Correct |
49 ms |
12720 KB |
Output is correct |
5 |
Correct |
53 ms |
12824 KB |
Output is correct |
6 |
Correct |
50 ms |
12752 KB |
Output is correct |
7 |
Correct |
50 ms |
12760 KB |
Output is correct |
8 |
Correct |
2 ms |
4948 KB |
Output is correct |
9 |
Correct |
2 ms |
4948 KB |
Output is correct |
10 |
Correct |
57 ms |
12800 KB |
Output is correct |
11 |
Correct |
57 ms |
12748 KB |
Output is correct |
12 |
Correct |
57 ms |
12752 KB |
Output is correct |
13 |
Correct |
57 ms |
12764 KB |
Output is correct |
14 |
Correct |
56 ms |
12784 KB |
Output is correct |
15 |
Correct |
57 ms |
12780 KB |
Output is correct |
16 |
Correct |
62 ms |
12820 KB |
Output is correct |
17 |
Correct |
56 ms |
12816 KB |
Output is correct |
18 |
Correct |
2 ms |
4948 KB |
Output is correct |
19 |
Correct |
94 ms |
13892 KB |
Output is correct |
20 |
Correct |
89 ms |
13856 KB |
Output is correct |
21 |
Correct |
72 ms |
13800 KB |
Output is correct |
22 |
Correct |
79 ms |
13980 KB |
Output is correct |
23 |
Correct |
82 ms |
14540 KB |
Output is correct |
24 |
Correct |
66 ms |
14844 KB |
Output is correct |
25 |
Correct |
60 ms |
14368 KB |
Output is correct |
26 |
Correct |
63 ms |
14400 KB |
Output is correct |
27 |
Correct |
71 ms |
14324 KB |
Output is correct |
28 |
Correct |
72 ms |
13036 KB |
Output is correct |
29 |
Correct |
71 ms |
13436 KB |
Output is correct |
30 |
Correct |
69 ms |
14080 KB |
Output is correct |
31 |
Correct |
63 ms |
14340 KB |
Output is correct |
32 |
Correct |
70 ms |
14376 KB |
Output is correct |
33 |
Correct |
72 ms |
15060 KB |
Output is correct |
34 |
Correct |
79 ms |
13948 KB |
Output is correct |
35 |
Correct |
76 ms |
14920 KB |
Output is correct |
36 |
Correct |
70 ms |
14912 KB |
Output is correct |
37 |
Correct |
72 ms |
14912 KB |
Output is correct |
38 |
Correct |
78 ms |
14536 KB |
Output is correct |
39 |
Correct |
69 ms |
13516 KB |
Output is correct |
40 |
Correct |
88 ms |
14072 KB |
Output is correct |
41 |
Correct |
67 ms |
12760 KB |
Output is correct |
42 |
Correct |
65 ms |
12788 KB |
Output is correct |
43 |
Correct |
78 ms |
14032 KB |
Output is correct |
44 |
Correct |
72 ms |
14020 KB |
Output is correct |
45 |
Correct |
72 ms |
14048 KB |
Output is correct |
46 |
Correct |
75 ms |
13964 KB |
Output is correct |
47 |
Correct |
80 ms |
14020 KB |
Output is correct |
48 |
Correct |
95 ms |
14036 KB |
Output is correct |
49 |
Correct |
71 ms |
14012 KB |
Output is correct |
50 |
Correct |
91 ms |
13988 KB |
Output is correct |
51 |
Correct |
82 ms |
14048 KB |
Output is correct |
52 |
Correct |
65 ms |
13920 KB |
Output is correct |
53 |
Incorrect |
2 ms |
4948 KB |
Output isn't correct |
54 |
Halted |
0 ms |
0 KB |
- |