답안 #1030887

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1030887 2024-07-22T11:23:52 Z Unforgettablepl Security Guard (JOI23_guard) C++17
37 / 100
84 ms 18512 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long


int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	int n,m,q;
	cin >> n >> m >> q;
	vector<int> arr(n+1);
	for(int i=1;i<=n;i++)cin>>arr[i];
	vector<vector<int>> adj(n+1);
	for(int i=1;i<n;i++){
		int a,b;
		cin >> a >> b;
		adj[a].emplace_back(b);
		adj[b].emplace_back(a);
	}
	int ans = 0;
	for(int i=1;i<=n;i++){
		ans+=arr[i]*(adj[i].size()-1ll);
	}
	cout << ans+(*max_element(arr.begin(),arr.end())) << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 38 ms 12780 KB Output is correct
3 Correct 39 ms 12896 KB Output is correct
4 Correct 38 ms 12880 KB Output is correct
5 Correct 40 ms 12880 KB Output is correct
6 Correct 37 ms 12884 KB Output is correct
7 Correct 38 ms 12744 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 38 ms 12780 KB Output is correct
3 Correct 39 ms 12896 KB Output is correct
4 Correct 38 ms 12880 KB Output is correct
5 Correct 40 ms 12880 KB Output is correct
6 Correct 37 ms 12884 KB Output is correct
7 Correct 38 ms 12744 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 45 ms 12940 KB Output is correct
11 Correct 46 ms 12928 KB Output is correct
12 Correct 45 ms 12864 KB Output is correct
13 Correct 44 ms 12864 KB Output is correct
14 Correct 47 ms 12808 KB Output is correct
15 Correct 46 ms 12884 KB Output is correct
16 Correct 44 ms 12784 KB Output is correct
17 Correct 44 ms 12884 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 38 ms 12780 KB Output is correct
3 Correct 39 ms 12896 KB Output is correct
4 Correct 38 ms 12880 KB Output is correct
5 Correct 40 ms 12880 KB Output is correct
6 Correct 37 ms 12884 KB Output is correct
7 Correct 38 ms 12744 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 45 ms 12940 KB Output is correct
11 Correct 46 ms 12928 KB Output is correct
12 Correct 45 ms 12864 KB Output is correct
13 Correct 44 ms 12864 KB Output is correct
14 Correct 47 ms 12808 KB Output is correct
15 Correct 46 ms 12884 KB Output is correct
16 Correct 44 ms 12784 KB Output is correct
17 Correct 44 ms 12884 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 64 ms 13824 KB Output is correct
20 Correct 56 ms 13988 KB Output is correct
21 Correct 66 ms 13908 KB Output is correct
22 Correct 55 ms 14164 KB Output is correct
23 Correct 54 ms 14672 KB Output is correct
24 Correct 54 ms 14928 KB Output is correct
25 Correct 50 ms 14520 KB Output is correct
26 Correct 50 ms 14392 KB Output is correct
27 Correct 48 ms 14320 KB Output is correct
28 Correct 59 ms 13132 KB Output is correct
29 Correct 54 ms 13448 KB Output is correct
30 Correct 50 ms 14136 KB Output is correct
31 Correct 49 ms 14528 KB Output is correct
32 Correct 61 ms 14792 KB Output is correct
33 Correct 60 ms 15188 KB Output is correct
34 Correct 63 ms 13908 KB Output is correct
35 Correct 84 ms 15048 KB Output is correct
36 Correct 55 ms 14924 KB Output is correct
37 Correct 56 ms 14928 KB Output is correct
38 Correct 57 ms 14536 KB Output is correct
39 Correct 51 ms 13512 KB Output is correct
40 Correct 61 ms 14144 KB Output is correct
41 Correct 58 ms 12924 KB Output is correct
42 Correct 57 ms 12880 KB Output is correct
43 Correct 61 ms 14160 KB Output is correct
44 Correct 71 ms 14164 KB Output is correct
45 Correct 59 ms 14060 KB Output is correct
46 Correct 58 ms 14164 KB Output is correct
47 Correct 68 ms 14168 KB Output is correct
48 Correct 62 ms 14164 KB Output is correct
49 Correct 62 ms 14164 KB Output is correct
50 Correct 62 ms 14164 KB Output is correct
51 Correct 57 ms 14164 KB Output is correct
52 Correct 61 ms 14164 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 38 ms 12780 KB Output is correct
3 Correct 39 ms 12896 KB Output is correct
4 Correct 38 ms 12880 KB Output is correct
5 Correct 40 ms 12880 KB Output is correct
6 Correct 37 ms 12884 KB Output is correct
7 Correct 38 ms 12744 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 45 ms 12940 KB Output is correct
11 Correct 46 ms 12928 KB Output is correct
12 Correct 45 ms 12864 KB Output is correct
13 Correct 44 ms 12864 KB Output is correct
14 Correct 47 ms 12808 KB Output is correct
15 Correct 46 ms 12884 KB Output is correct
16 Correct 44 ms 12784 KB Output is correct
17 Correct 44 ms 12884 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 64 ms 13824 KB Output is correct
20 Correct 56 ms 13988 KB Output is correct
21 Correct 66 ms 13908 KB Output is correct
22 Correct 55 ms 14164 KB Output is correct
23 Correct 54 ms 14672 KB Output is correct
24 Correct 54 ms 14928 KB Output is correct
25 Correct 50 ms 14520 KB Output is correct
26 Correct 50 ms 14392 KB Output is correct
27 Correct 48 ms 14320 KB Output is correct
28 Correct 59 ms 13132 KB Output is correct
29 Correct 54 ms 13448 KB Output is correct
30 Correct 50 ms 14136 KB Output is correct
31 Correct 49 ms 14528 KB Output is correct
32 Correct 61 ms 14792 KB Output is correct
33 Correct 60 ms 15188 KB Output is correct
34 Correct 63 ms 13908 KB Output is correct
35 Correct 84 ms 15048 KB Output is correct
36 Correct 55 ms 14924 KB Output is correct
37 Correct 56 ms 14928 KB Output is correct
38 Correct 57 ms 14536 KB Output is correct
39 Correct 51 ms 13512 KB Output is correct
40 Correct 61 ms 14144 KB Output is correct
41 Correct 58 ms 12924 KB Output is correct
42 Correct 57 ms 12880 KB Output is correct
43 Correct 61 ms 14160 KB Output is correct
44 Correct 71 ms 14164 KB Output is correct
45 Correct 59 ms 14060 KB Output is correct
46 Correct 58 ms 14164 KB Output is correct
47 Correct 68 ms 14168 KB Output is correct
48 Correct 62 ms 14164 KB Output is correct
49 Correct 62 ms 14164 KB Output is correct
50 Correct 62 ms 14164 KB Output is correct
51 Correct 57 ms 14164 KB Output is correct
52 Correct 61 ms 14164 KB Output is correct
53 Correct 0 ms 344 KB Output is correct
54 Incorrect 59 ms 18512 KB Output isn't correct
55 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 38 ms 12780 KB Output is correct
3 Correct 39 ms 12896 KB Output is correct
4 Correct 38 ms 12880 KB Output is correct
5 Correct 40 ms 12880 KB Output is correct
6 Correct 37 ms 12884 KB Output is correct
7 Correct 38 ms 12744 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 45 ms 12940 KB Output is correct
11 Correct 46 ms 12928 KB Output is correct
12 Correct 45 ms 12864 KB Output is correct
13 Correct 44 ms 12864 KB Output is correct
14 Correct 47 ms 12808 KB Output is correct
15 Correct 46 ms 12884 KB Output is correct
16 Correct 44 ms 12784 KB Output is correct
17 Correct 44 ms 12884 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 64 ms 13824 KB Output is correct
20 Correct 56 ms 13988 KB Output is correct
21 Correct 66 ms 13908 KB Output is correct
22 Correct 55 ms 14164 KB Output is correct
23 Correct 54 ms 14672 KB Output is correct
24 Correct 54 ms 14928 KB Output is correct
25 Correct 50 ms 14520 KB Output is correct
26 Correct 50 ms 14392 KB Output is correct
27 Correct 48 ms 14320 KB Output is correct
28 Correct 59 ms 13132 KB Output is correct
29 Correct 54 ms 13448 KB Output is correct
30 Correct 50 ms 14136 KB Output is correct
31 Correct 49 ms 14528 KB Output is correct
32 Correct 61 ms 14792 KB Output is correct
33 Correct 60 ms 15188 KB Output is correct
34 Correct 63 ms 13908 KB Output is correct
35 Correct 84 ms 15048 KB Output is correct
36 Correct 55 ms 14924 KB Output is correct
37 Correct 56 ms 14928 KB Output is correct
38 Correct 57 ms 14536 KB Output is correct
39 Correct 51 ms 13512 KB Output is correct
40 Correct 61 ms 14144 KB Output is correct
41 Correct 58 ms 12924 KB Output is correct
42 Correct 57 ms 12880 KB Output is correct
43 Correct 61 ms 14160 KB Output is correct
44 Correct 71 ms 14164 KB Output is correct
45 Correct 59 ms 14060 KB Output is correct
46 Correct 58 ms 14164 KB Output is correct
47 Correct 68 ms 14168 KB Output is correct
48 Correct 62 ms 14164 KB Output is correct
49 Correct 62 ms 14164 KB Output is correct
50 Correct 62 ms 14164 KB Output is correct
51 Correct 57 ms 14164 KB Output is correct
52 Correct 61 ms 14164 KB Output is correct
53 Correct 0 ms 344 KB Output is correct
54 Incorrect 59 ms 18512 KB Output isn't correct
55 Halted 0 ms 0 KB -