#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
using ll = long long;
int n,m,q;
int s[N],deg[N];
ll ans;
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
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;
deg[u]++,deg[v]++;
}
ans=*max_element(s+1,s+n+1);
for(int i=1;i<=n;i++)ans+=1LL*(deg[i]-1)*s[i];
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
42 ms |
5028 KB |
Output is correct |
3 |
Correct |
33 ms |
4816 KB |
Output is correct |
4 |
Correct |
34 ms |
4856 KB |
Output is correct |
5 |
Correct |
33 ms |
4700 KB |
Output is correct |
6 |
Correct |
32 ms |
4700 KB |
Output is correct |
7 |
Correct |
32 ms |
4860 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
42 ms |
5028 KB |
Output is correct |
3 |
Correct |
33 ms |
4816 KB |
Output is correct |
4 |
Correct |
34 ms |
4856 KB |
Output is correct |
5 |
Correct |
33 ms |
4700 KB |
Output is correct |
6 |
Correct |
32 ms |
4700 KB |
Output is correct |
7 |
Correct |
32 ms |
4860 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
44 ms |
6388 KB |
Output is correct |
11 |
Correct |
52 ms |
6480 KB |
Output is correct |
12 |
Correct |
40 ms |
6384 KB |
Output is correct |
13 |
Correct |
39 ms |
6232 KB |
Output is correct |
14 |
Correct |
39 ms |
6224 KB |
Output is correct |
15 |
Correct |
40 ms |
6228 KB |
Output is correct |
16 |
Correct |
39 ms |
6224 KB |
Output is correct |
17 |
Correct |
40 ms |
6372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
42 ms |
5028 KB |
Output is correct |
3 |
Correct |
33 ms |
4816 KB |
Output is correct |
4 |
Correct |
34 ms |
4856 KB |
Output is correct |
5 |
Correct |
33 ms |
4700 KB |
Output is correct |
6 |
Correct |
32 ms |
4700 KB |
Output is correct |
7 |
Correct |
32 ms |
4860 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
44 ms |
6388 KB |
Output is correct |
11 |
Correct |
52 ms |
6480 KB |
Output is correct |
12 |
Correct |
40 ms |
6384 KB |
Output is correct |
13 |
Correct |
39 ms |
6232 KB |
Output is correct |
14 |
Correct |
39 ms |
6224 KB |
Output is correct |
15 |
Correct |
40 ms |
6228 KB |
Output is correct |
16 |
Correct |
39 ms |
6224 KB |
Output is correct |
17 |
Correct |
40 ms |
6372 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
42 ms |
6312 KB |
Output is correct |
20 |
Correct |
42 ms |
6216 KB |
Output is correct |
21 |
Correct |
48 ms |
6428 KB |
Output is correct |
22 |
Correct |
49 ms |
6228 KB |
Output is correct |
23 |
Correct |
40 ms |
6224 KB |
Output is correct |
24 |
Correct |
45 ms |
6348 KB |
Output is correct |
25 |
Correct |
45 ms |
6484 KB |
Output is correct |
26 |
Correct |
41 ms |
6228 KB |
Output is correct |
27 |
Correct |
40 ms |
6224 KB |
Output is correct |
28 |
Correct |
46 ms |
6740 KB |
Output is correct |
29 |
Correct |
40 ms |
6232 KB |
Output is correct |
30 |
Correct |
41 ms |
6224 KB |
Output is correct |
31 |
Correct |
49 ms |
6476 KB |
Output is correct |
32 |
Correct |
46 ms |
6480 KB |
Output is correct |
33 |
Correct |
37 ms |
5456 KB |
Output is correct |
34 |
Correct |
42 ms |
6344 KB |
Output is correct |
35 |
Correct |
43 ms |
6484 KB |
Output is correct |
36 |
Correct |
45 ms |
6480 KB |
Output is correct |
37 |
Correct |
52 ms |
6484 KB |
Output is correct |
38 |
Correct |
42 ms |
6228 KB |
Output is correct |
39 |
Correct |
42 ms |
6236 KB |
Output is correct |
40 |
Correct |
42 ms |
6220 KB |
Output is correct |
41 |
Correct |
46 ms |
5716 KB |
Output is correct |
42 |
Correct |
49 ms |
5716 KB |
Output is correct |
43 |
Correct |
43 ms |
6236 KB |
Output is correct |
44 |
Correct |
41 ms |
6212 KB |
Output is correct |
45 |
Correct |
42 ms |
6484 KB |
Output is correct |
46 |
Correct |
47 ms |
6484 KB |
Output is correct |
47 |
Correct |
53 ms |
6416 KB |
Output is correct |
48 |
Correct |
41 ms |
6480 KB |
Output is correct |
49 |
Correct |
42 ms |
6224 KB |
Output is correct |
50 |
Correct |
42 ms |
6224 KB |
Output is correct |
51 |
Correct |
55 ms |
6788 KB |
Output is correct |
52 |
Correct |
37 ms |
4704 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
42 ms |
5028 KB |
Output is correct |
3 |
Correct |
33 ms |
4816 KB |
Output is correct |
4 |
Correct |
34 ms |
4856 KB |
Output is correct |
5 |
Correct |
33 ms |
4700 KB |
Output is correct |
6 |
Correct |
32 ms |
4700 KB |
Output is correct |
7 |
Correct |
32 ms |
4860 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
44 ms |
6388 KB |
Output is correct |
11 |
Correct |
52 ms |
6480 KB |
Output is correct |
12 |
Correct |
40 ms |
6384 KB |
Output is correct |
13 |
Correct |
39 ms |
6232 KB |
Output is correct |
14 |
Correct |
39 ms |
6224 KB |
Output is correct |
15 |
Correct |
40 ms |
6228 KB |
Output is correct |
16 |
Correct |
39 ms |
6224 KB |
Output is correct |
17 |
Correct |
40 ms |
6372 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
42 ms |
6312 KB |
Output is correct |
20 |
Correct |
42 ms |
6216 KB |
Output is correct |
21 |
Correct |
48 ms |
6428 KB |
Output is correct |
22 |
Correct |
49 ms |
6228 KB |
Output is correct |
23 |
Correct |
40 ms |
6224 KB |
Output is correct |
24 |
Correct |
45 ms |
6348 KB |
Output is correct |
25 |
Correct |
45 ms |
6484 KB |
Output is correct |
26 |
Correct |
41 ms |
6228 KB |
Output is correct |
27 |
Correct |
40 ms |
6224 KB |
Output is correct |
28 |
Correct |
46 ms |
6740 KB |
Output is correct |
29 |
Correct |
40 ms |
6232 KB |
Output is correct |
30 |
Correct |
41 ms |
6224 KB |
Output is correct |
31 |
Correct |
49 ms |
6476 KB |
Output is correct |
32 |
Correct |
46 ms |
6480 KB |
Output is correct |
33 |
Correct |
37 ms |
5456 KB |
Output is correct |
34 |
Correct |
42 ms |
6344 KB |
Output is correct |
35 |
Correct |
43 ms |
6484 KB |
Output is correct |
36 |
Correct |
45 ms |
6480 KB |
Output is correct |
37 |
Correct |
52 ms |
6484 KB |
Output is correct |
38 |
Correct |
42 ms |
6228 KB |
Output is correct |
39 |
Correct |
42 ms |
6236 KB |
Output is correct |
40 |
Correct |
42 ms |
6220 KB |
Output is correct |
41 |
Correct |
46 ms |
5716 KB |
Output is correct |
42 |
Correct |
49 ms |
5716 KB |
Output is correct |
43 |
Correct |
43 ms |
6236 KB |
Output is correct |
44 |
Correct |
41 ms |
6212 KB |
Output is correct |
45 |
Correct |
42 ms |
6484 KB |
Output is correct |
46 |
Correct |
47 ms |
6484 KB |
Output is correct |
47 |
Correct |
53 ms |
6416 KB |
Output is correct |
48 |
Correct |
41 ms |
6480 KB |
Output is correct |
49 |
Correct |
42 ms |
6224 KB |
Output is correct |
50 |
Correct |
42 ms |
6224 KB |
Output is correct |
51 |
Correct |
55 ms |
6788 KB |
Output is correct |
52 |
Correct |
37 ms |
4704 KB |
Output is correct |
53 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
54 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
42 ms |
5028 KB |
Output is correct |
3 |
Correct |
33 ms |
4816 KB |
Output is correct |
4 |
Correct |
34 ms |
4856 KB |
Output is correct |
5 |
Correct |
33 ms |
4700 KB |
Output is correct |
6 |
Correct |
32 ms |
4700 KB |
Output is correct |
7 |
Correct |
32 ms |
4860 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
44 ms |
6388 KB |
Output is correct |
11 |
Correct |
52 ms |
6480 KB |
Output is correct |
12 |
Correct |
40 ms |
6384 KB |
Output is correct |
13 |
Correct |
39 ms |
6232 KB |
Output is correct |
14 |
Correct |
39 ms |
6224 KB |
Output is correct |
15 |
Correct |
40 ms |
6228 KB |
Output is correct |
16 |
Correct |
39 ms |
6224 KB |
Output is correct |
17 |
Correct |
40 ms |
6372 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
42 ms |
6312 KB |
Output is correct |
20 |
Correct |
42 ms |
6216 KB |
Output is correct |
21 |
Correct |
48 ms |
6428 KB |
Output is correct |
22 |
Correct |
49 ms |
6228 KB |
Output is correct |
23 |
Correct |
40 ms |
6224 KB |
Output is correct |
24 |
Correct |
45 ms |
6348 KB |
Output is correct |
25 |
Correct |
45 ms |
6484 KB |
Output is correct |
26 |
Correct |
41 ms |
6228 KB |
Output is correct |
27 |
Correct |
40 ms |
6224 KB |
Output is correct |
28 |
Correct |
46 ms |
6740 KB |
Output is correct |
29 |
Correct |
40 ms |
6232 KB |
Output is correct |
30 |
Correct |
41 ms |
6224 KB |
Output is correct |
31 |
Correct |
49 ms |
6476 KB |
Output is correct |
32 |
Correct |
46 ms |
6480 KB |
Output is correct |
33 |
Correct |
37 ms |
5456 KB |
Output is correct |
34 |
Correct |
42 ms |
6344 KB |
Output is correct |
35 |
Correct |
43 ms |
6484 KB |
Output is correct |
36 |
Correct |
45 ms |
6480 KB |
Output is correct |
37 |
Correct |
52 ms |
6484 KB |
Output is correct |
38 |
Correct |
42 ms |
6228 KB |
Output is correct |
39 |
Correct |
42 ms |
6236 KB |
Output is correct |
40 |
Correct |
42 ms |
6220 KB |
Output is correct |
41 |
Correct |
46 ms |
5716 KB |
Output is correct |
42 |
Correct |
49 ms |
5716 KB |
Output is correct |
43 |
Correct |
43 ms |
6236 KB |
Output is correct |
44 |
Correct |
41 ms |
6212 KB |
Output is correct |
45 |
Correct |
42 ms |
6484 KB |
Output is correct |
46 |
Correct |
47 ms |
6484 KB |
Output is correct |
47 |
Correct |
53 ms |
6416 KB |
Output is correct |
48 |
Correct |
41 ms |
6480 KB |
Output is correct |
49 |
Correct |
42 ms |
6224 KB |
Output is correct |
50 |
Correct |
42 ms |
6224 KB |
Output is correct |
51 |
Correct |
55 ms |
6788 KB |
Output is correct |
52 |
Correct |
37 ms |
4704 KB |
Output is correct |
53 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
54 |
Halted |
0 ms |
0 KB |
- |