# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
26388 | 2017-06-29T17:28:17 Z | samir_droubi | Pipes (BOI13_pipes) | C++14 | 676 ms | 55916 KB |
#include <bits/stdc++.h> using namespace std; int n,m; const int mxn=(1e5)+5; int c[mxn]; set<pair<int,int> > s; set<pair<int,int> >gr[mxn]; int ans[mxn*5]; int main() { scanf("%d%d",&n,&m); for(int i=1;i<=n;++i) scanf("%d",&c[i]); for(int i=1;i<=m;++i) { int x,y; scanf("%d%d",&x,&y); gr[x].insert({y,i}); gr[y].insert({x,i}); } if(m>=n) { puts("0"); return 0; } for(int i=1;i<=n;++i) s.insert({gr[i].size(),i}); while(!s.empty()) { int v=s.begin()->second; int u=gr[v].begin()->first; int in=gr[v].begin()->second; s.erase(s.begin()); gr[u].erase({v,in}); ans[in]=2*c[v]; c[u]-=c[v]; } for(int i=1;i<=m;++i)printf("%d\n",ans[i]); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 9056 KB | Output isn't correct |
2 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
3 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
4 | Incorrect | 209 ms | 23048 KB | Output isn't correct |
5 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
6 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
7 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
8 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
9 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
10 | Incorrect | 3 ms | 9188 KB | Output isn't correct |
11 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
12 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
13 | Incorrect | 153 ms | 20276 KB | Output isn't correct |
14 | Incorrect | 199 ms | 22256 KB | Output isn't correct |
15 | Incorrect | 203 ms | 23180 KB | Output isn't correct |
16 | Incorrect | 156 ms | 20936 KB | Output isn't correct |
17 | Incorrect | 216 ms | 23048 KB | Output isn't correct |
18 | Incorrect | 196 ms | 23180 KB | Output isn't correct |
19 | Incorrect | 156 ms | 23180 KB | Output isn't correct |
20 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
21 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
22 | Incorrect | 203 ms | 23180 KB | Output isn't correct |
23 | Incorrect | 149 ms | 20144 KB | Output isn't correct |
24 | Incorrect | 176 ms | 23180 KB | Output isn't correct |
25 | Incorrect | 176 ms | 20804 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
2 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
3 | Correct | 103 ms | 17900 KB | Output is correct |
4 | Correct | 96 ms | 18428 KB | Output is correct |
5 | Correct | 96 ms | 18164 KB | Output is correct |
6 | Correct | 676 ms | 55916 KB | Output is correct |
7 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
8 | Incorrect | 3 ms | 9056 KB | Output isn't correct |
9 | Correct | 3 ms | 9056 KB | Output is correct |
10 | Correct | 3 ms | 9056 KB | Output is correct |
11 | Correct | 3 ms | 9056 KB | Output is correct |
12 | Correct | 3 ms | 9056 KB | Output is correct |
13 | Correct | 0 ms | 9056 KB | Output is correct |
14 | Incorrect | 0 ms | 9056 KB | Output isn't correct |
15 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
16 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
17 | Correct | 0 ms | 9188 KB | Output is correct |
18 | Correct | 0 ms | 9188 KB | Output is correct |
19 | Correct | 3 ms | 9188 KB | Output is correct |
20 | Correct | 0 ms | 9188 KB | Output is correct |
21 | Correct | 0 ms | 9320 KB | Output is correct |
22 | Incorrect | 0 ms | 9188 KB | Output isn't correct |
23 | Incorrect | 83 ms | 16712 KB | Output isn't correct |
24 | Incorrect | 99 ms | 18428 KB | Output isn't correct |
25 | Correct | 99 ms | 17900 KB | Output is correct |
26 | Correct | 109 ms | 18428 KB | Output is correct |
27 | Correct | 106 ms | 18428 KB | Output is correct |
28 | Correct | 119 ms | 18956 KB | Output is correct |
29 | Correct | 506 ms | 46676 KB | Output is correct |
30 | Incorrect | 96 ms | 18296 KB | Output isn't correct |
31 | Incorrect | 89 ms | 18428 KB | Output isn't correct |
32 | Incorrect | 116 ms | 18428 KB | Output isn't correct |
33 | Correct | 103 ms | 18428 KB | Output is correct |
34 | Correct | 89 ms | 18428 KB | Output is correct |
35 | Correct | 93 ms | 18428 KB | Output is correct |
36 | Correct | 116 ms | 18560 KB | Output is correct |
37 | Correct | 653 ms | 55916 KB | Output is correct |
38 | Incorrect | 99 ms | 18428 KB | Output isn't correct |
39 | Incorrect | 99 ms | 18428 KB | Output isn't correct |
40 | Incorrect | 103 ms | 18428 KB | Output isn't correct |
41 | Correct | 93 ms | 18428 KB | Output is correct |
42 | Correct | 93 ms | 18428 KB | Output is correct |
43 | Correct | 93 ms | 18428 KB | Output is correct |
44 | Correct | 96 ms | 18164 KB | Output is correct |
45 | Correct | 589 ms | 50636 KB | Output is correct |
46 | Incorrect | 113 ms | 18428 KB | Output isn't correct |
47 | Incorrect | 106 ms | 18428 KB | Output isn't correct |
48 | Incorrect | 109 ms | 18428 KB | Output isn't correct |
49 | Correct | 99 ms | 17900 KB | Output is correct |
50 | Correct | 86 ms | 18428 KB | Output is correct |
51 | Correct | 96 ms | 18428 KB | Output is correct |
52 | Correct | 96 ms | 18296 KB | Output is correct |
53 | Correct | 529 ms | 51428 KB | Output is correct |
54 | Incorrect | 99 ms | 18296 KB | Output isn't correct |