답안 #1055805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055805 2024-08-13T05:40:51 Z 근데 드레이븐이 문제에요 이 와중에 진짜 예 타워 안쪽 (#11111) Treasure Hunt (CCO24_day1problem1) C++17
25 / 25
981 ms 114960 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int n, m, a[1001001];
vector<array<int, 2>> v[1001001];
priority_queue<array<int, 2>> pq;

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> m;
	for(int i=1;i<=n;i++) cin >> a[i];
	for(int i=1;i<=m;i++) {
		int a, b, c; cin >> a >> b >> c;
		v[a].push_back({b, c});
		v[b].push_back({a, c});
	}
	for(int i=1;i<=n;i++) pq.push({a[i], i});
	while(!pq.empty()) {
		auto [c, u] = pq.top(); pq.pop();
		if(a[u] > c) continue;
		for(auto [x, y] : v[u]) if(c-y > a[x]) a[x] = c-y, pq.push({c-y, x});
	}
	for(int i=1;i<=n;i++) cout << a[i] << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 24156 KB Output is correct
2 Correct 9 ms 24140 KB Output is correct
3 Correct 10 ms 24156 KB Output is correct
4 Correct 9 ms 24156 KB Output is correct
5 Correct 8 ms 23900 KB Output is correct
6 Correct 8 ms 23900 KB Output is correct
7 Correct 9 ms 23836 KB Output is correct
8 Correct 9 ms 24156 KB Output is correct
9 Correct 9 ms 24176 KB Output is correct
10 Correct 10 ms 24156 KB Output is correct
11 Correct 9 ms 24048 KB Output is correct
12 Correct 9 ms 23940 KB Output is correct
13 Correct 7 ms 23740 KB Output is correct
14 Correct 8 ms 23868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 968 ms 107248 KB Output is correct
2 Correct 842 ms 107388 KB Output is correct
3 Correct 910 ms 83152 KB Output is correct
4 Correct 850 ms 82244 KB Output is correct
5 Correct 838 ms 80856 KB Output is correct
6 Correct 831 ms 80748 KB Output is correct
7 Correct 758 ms 78504 KB Output is correct
8 Correct 789 ms 78508 KB Output is correct
9 Correct 684 ms 75440 KB Output is correct
10 Correct 719 ms 75436 KB Output is correct
11 Correct 615 ms 72112 KB Output is correct
12 Correct 669 ms 71952 KB Output is correct
13 Correct 552 ms 68524 KB Output is correct
14 Correct 568 ms 68780 KB Output is correct
15 Correct 261 ms 53816 KB Output is correct
16 Correct 261 ms 53956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 898 ms 82232 KB Output is correct
2 Correct 981 ms 82092 KB Output is correct
3 Correct 903 ms 82088 KB Output is correct
4 Correct 908 ms 82148 KB Output is correct
5 Correct 8 ms 23900 KB Output is correct
6 Correct 8 ms 23900 KB Output is correct
7 Correct 948 ms 82448 KB Output is correct
8 Correct 905 ms 82500 KB Output is correct
9 Correct 902 ms 82344 KB Output is correct
10 Correct 835 ms 82264 KB Output is correct
11 Correct 9 ms 23896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 24156 KB Output is correct
2 Correct 9 ms 24140 KB Output is correct
3 Correct 10 ms 24156 KB Output is correct
4 Correct 9 ms 24156 KB Output is correct
5 Correct 8 ms 23900 KB Output is correct
6 Correct 8 ms 23900 KB Output is correct
7 Correct 9 ms 23836 KB Output is correct
8 Correct 9 ms 24156 KB Output is correct
9 Correct 9 ms 24176 KB Output is correct
10 Correct 10 ms 24156 KB Output is correct
11 Correct 9 ms 24048 KB Output is correct
12 Correct 9 ms 23940 KB Output is correct
13 Correct 7 ms 23740 KB Output is correct
14 Correct 8 ms 23868 KB Output is correct
15 Correct 968 ms 107248 KB Output is correct
16 Correct 842 ms 107388 KB Output is correct
17 Correct 910 ms 83152 KB Output is correct
18 Correct 850 ms 82244 KB Output is correct
19 Correct 838 ms 80856 KB Output is correct
20 Correct 831 ms 80748 KB Output is correct
21 Correct 758 ms 78504 KB Output is correct
22 Correct 789 ms 78508 KB Output is correct
23 Correct 684 ms 75440 KB Output is correct
24 Correct 719 ms 75436 KB Output is correct
25 Correct 615 ms 72112 KB Output is correct
26 Correct 669 ms 71952 KB Output is correct
27 Correct 552 ms 68524 KB Output is correct
28 Correct 568 ms 68780 KB Output is correct
29 Correct 261 ms 53816 KB Output is correct
30 Correct 261 ms 53956 KB Output is correct
31 Correct 898 ms 82232 KB Output is correct
32 Correct 981 ms 82092 KB Output is correct
33 Correct 903 ms 82088 KB Output is correct
34 Correct 908 ms 82148 KB Output is correct
35 Correct 8 ms 23900 KB Output is correct
36 Correct 8 ms 23900 KB Output is correct
37 Correct 948 ms 82448 KB Output is correct
38 Correct 905 ms 82500 KB Output is correct
39 Correct 902 ms 82344 KB Output is correct
40 Correct 835 ms 82264 KB Output is correct
41 Correct 9 ms 23896 KB Output is correct
42 Correct 905 ms 96036 KB Output is correct
43 Correct 837 ms 114960 KB Output is correct
44 Correct 832 ms 99880 KB Output is correct
45 Correct 842 ms 108196 KB Output is correct
46 Correct 862 ms 98432 KB Output is correct
47 Correct 908 ms 93668 KB Output is correct
48 Correct 885 ms 103744 KB Output is correct
49 Correct 759 ms 90544 KB Output is correct
50 Correct 834 ms 93088 KB Output is correct
51 Correct 279 ms 64304 KB Output is correct
52 Correct 264 ms 55980 KB Output is correct
53 Correct 158 ms 49236 KB Output is correct
54 Correct 150 ms 52360 KB Output is correct
55 Correct 871 ms 102928 KB Output is correct
56 Correct 868 ms 84988 KB Output is correct
57 Correct 322 ms 76976 KB Output is correct