# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
885095 |
2023-12-09T02:14:15 Z |
12345678 |
Pipes (BOI13_pipes) |
C++17 |
|
106 ms |
23644 KB |
#include <bits/stdc++.h>
using namespace std;
const int nx=1e5+5;
int n, m, h[nx], u, v, sz, res[nx];
vector<pair<int, int>> d[nx];
void dfs(int u, int p, int idx)
{
for (auto [v, id]:d[u]) if (v!=p) dfs(v, u, id);
if (idx==-1) return;
res[idx]=2*h[u];
h[p]-=h[u];
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n>>m;
for (int i=1; i<=n; i++) cin>>h[i];
for (int i=1; i<=m; i++) cin>>u>>v, d[u].push_back({v, i}), d[v].push_back({u, i});
if (m>=n)
{
cout<<0;
return 0;
}
dfs(1, 1, -1);
for (int i=1; i<n; i++) cout<<res[i]<<'\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2652 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
1 ms |
2648 KB |
Output is correct |
4 |
Correct |
38 ms |
9240 KB |
Output is correct |
5 |
Correct |
1 ms |
2704 KB |
Output is correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2648 KB |
Output is correct |
10 |
Correct |
1 ms |
2652 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2904 KB |
Output is correct |
13 |
Correct |
28 ms |
7804 KB |
Output is correct |
14 |
Correct |
33 ms |
8784 KB |
Output is correct |
15 |
Correct |
44 ms |
9312 KB |
Output is correct |
16 |
Correct |
29 ms |
8276 KB |
Output is correct |
17 |
Correct |
34 ms |
9296 KB |
Output is correct |
18 |
Correct |
34 ms |
9224 KB |
Output is correct |
19 |
Correct |
41 ms |
11752 KB |
Output is correct |
20 |
Correct |
1 ms |
2804 KB |
Output is correct |
21 |
Correct |
1 ms |
2648 KB |
Output is correct |
22 |
Correct |
35 ms |
9300 KB |
Output is correct |
23 |
Correct |
27 ms |
7776 KB |
Output is correct |
24 |
Correct |
34 ms |
9228 KB |
Output is correct |
25 |
Correct |
28 ms |
8020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2812 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
2664 KB |
Output isn't correct |
3 |
Correct |
24 ms |
7904 KB |
Output is correct |
4 |
Correct |
25 ms |
7800 KB |
Output is correct |
5 |
Correct |
25 ms |
8028 KB |
Output is correct |
6 |
Correct |
106 ms |
23228 KB |
Output is correct |
7 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2808 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
13 |
Correct |
1 ms |
2652 KB |
Output is correct |
14 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
16 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
17 |
Correct |
1 ms |
2648 KB |
Output is correct |
18 |
Correct |
1 ms |
2652 KB |
Output is correct |
19 |
Correct |
1 ms |
2648 KB |
Output is correct |
20 |
Correct |
1 ms |
2652 KB |
Output is correct |
21 |
Correct |
1 ms |
2820 KB |
Output is correct |
22 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
23 |
Incorrect |
20 ms |
7096 KB |
Output isn't correct |
24 |
Incorrect |
26 ms |
8024 KB |
Output isn't correct |
25 |
Correct |
24 ms |
7920 KB |
Output is correct |
26 |
Correct |
25 ms |
8016 KB |
Output is correct |
27 |
Correct |
25 ms |
7760 KB |
Output is correct |
28 |
Correct |
26 ms |
8276 KB |
Output is correct |
29 |
Correct |
79 ms |
19280 KB |
Output is correct |
30 |
Incorrect |
24 ms |
7772 KB |
Output isn't correct |
31 |
Incorrect |
26 ms |
7884 KB |
Output isn't correct |
32 |
Incorrect |
26 ms |
8276 KB |
Output isn't correct |
33 |
Correct |
25 ms |
8020 KB |
Output is correct |
34 |
Correct |
27 ms |
8028 KB |
Output is correct |
35 |
Correct |
25 ms |
8028 KB |
Output is correct |
36 |
Correct |
26 ms |
8328 KB |
Output is correct |
37 |
Correct |
99 ms |
23644 KB |
Output is correct |
38 |
Incorrect |
25 ms |
8016 KB |
Output isn't correct |
39 |
Incorrect |
26 ms |
8224 KB |
Output isn't correct |
40 |
Incorrect |
26 ms |
7972 KB |
Output isn't correct |
41 |
Correct |
25 ms |
7796 KB |
Output is correct |
42 |
Correct |
26 ms |
7764 KB |
Output is correct |
43 |
Correct |
26 ms |
7808 KB |
Output is correct |
44 |
Correct |
27 ms |
8024 KB |
Output is correct |
45 |
Correct |
81 ms |
20560 KB |
Output is correct |
46 |
Incorrect |
25 ms |
7764 KB |
Output isn't correct |
47 |
Incorrect |
26 ms |
8028 KB |
Output isn't correct |
48 |
Incorrect |
29 ms |
7888 KB |
Output isn't correct |
49 |
Correct |
24 ms |
8028 KB |
Output is correct |
50 |
Correct |
26 ms |
8028 KB |
Output is correct |
51 |
Correct |
25 ms |
8028 KB |
Output is correct |
52 |
Correct |
25 ms |
7760 KB |
Output is correct |
53 |
Correct |
83 ms |
20552 KB |
Output is correct |
54 |
Incorrect |
25 ms |
7804 KB |
Output isn't correct |