# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
885096 |
2023-12-09T02:15:48 Z |
12345678 |
Pipes (BOI13_pipes) |
C++17 |
|
109 ms |
17388 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=1e5+5;
ll 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 |
2804 KB |
Output is correct |
2 |
Correct |
1 ms |
2660 KB |
Output is correct |
3 |
Correct |
2 ms |
2648 KB |
Output is correct |
4 |
Correct |
36 ms |
8536 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 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 |
2 ms |
2652 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 |
2908 KB |
Output is correct |
13 |
Correct |
31 ms |
7172 KB |
Output is correct |
14 |
Correct |
41 ms |
8008 KB |
Output is correct |
15 |
Correct |
38 ms |
8532 KB |
Output is correct |
16 |
Correct |
42 ms |
7668 KB |
Output is correct |
17 |
Correct |
40 ms |
8276 KB |
Output is correct |
18 |
Correct |
40 ms |
8456 KB |
Output is correct |
19 |
Correct |
41 ms |
10840 KB |
Output is correct |
20 |
Correct |
1 ms |
2648 KB |
Output is correct |
21 |
Correct |
1 ms |
2652 KB |
Output is correct |
22 |
Correct |
34 ms |
8460 KB |
Output is correct |
23 |
Correct |
27 ms |
7120 KB |
Output is correct |
24 |
Correct |
46 ms |
8532 KB |
Output is correct |
25 |
Correct |
29 ms |
7576 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
3 |
Correct |
40 ms |
6848 KB |
Output is correct |
4 |
Correct |
31 ms |
6608 KB |
Output is correct |
5 |
Correct |
29 ms |
6844 KB |
Output is correct |
6 |
Correct |
107 ms |
17388 KB |
Output is correct |
7 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
8 |
Incorrect |
1 ms |
2648 KB |
Output isn't correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2652 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
2 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 |
2648 KB |
Output isn't correct |
17 |
Correct |
1 ms |
2652 KB |
Output is correct |
18 |
Correct |
1 ms |
2652 KB |
Output is correct |
19 |
Correct |
1 ms |
2652 KB |
Output is correct |
20 |
Correct |
1 ms |
2652 KB |
Output is correct |
21 |
Correct |
1 ms |
2908 KB |
Output is correct |
22 |
Incorrect |
1 ms |
2652 KB |
Output isn't correct |
23 |
Incorrect |
20 ms |
5976 KB |
Output isn't correct |
24 |
Incorrect |
34 ms |
6748 KB |
Output isn't correct |
25 |
Correct |
24 ms |
6748 KB |
Output is correct |
26 |
Correct |
25 ms |
6748 KB |
Output is correct |
27 |
Correct |
25 ms |
6748 KB |
Output is correct |
28 |
Correct |
26 ms |
6996 KB |
Output is correct |
29 |
Correct |
91 ms |
15012 KB |
Output is correct |
30 |
Incorrect |
25 ms |
6492 KB |
Output isn't correct |
31 |
Incorrect |
25 ms |
6628 KB |
Output isn't correct |
32 |
Incorrect |
25 ms |
7016 KB |
Output isn't correct |
33 |
Correct |
25 ms |
7000 KB |
Output is correct |
34 |
Correct |
25 ms |
6740 KB |
Output is correct |
35 |
Correct |
26 ms |
6748 KB |
Output is correct |
36 |
Correct |
27 ms |
7032 KB |
Output is correct |
37 |
Correct |
109 ms |
17324 KB |
Output is correct |
38 |
Incorrect |
27 ms |
6720 KB |
Output isn't correct |
39 |
Incorrect |
25 ms |
7068 KB |
Output isn't correct |
40 |
Incorrect |
30 ms |
6824 KB |
Output isn't correct |
41 |
Correct |
36 ms |
6744 KB |
Output is correct |
42 |
Correct |
25 ms |
6484 KB |
Output is correct |
43 |
Correct |
25 ms |
6748 KB |
Output is correct |
44 |
Correct |
25 ms |
6824 KB |
Output is correct |
45 |
Correct |
79 ms |
15440 KB |
Output is correct |
46 |
Incorrect |
26 ms |
6588 KB |
Output isn't correct |
47 |
Incorrect |
25 ms |
6760 KB |
Output isn't correct |
48 |
Incorrect |
25 ms |
6628 KB |
Output isn't correct |
49 |
Correct |
24 ms |
7004 KB |
Output is correct |
50 |
Correct |
31 ms |
6788 KB |
Output is correct |
51 |
Correct |
25 ms |
6832 KB |
Output is correct |
52 |
Correct |
26 ms |
6748 KB |
Output is correct |
53 |
Correct |
85 ms |
15348 KB |
Output is correct |
54 |
Incorrect |
25 ms |
6748 KB |
Output isn't correct |