답안 #94370

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94370 2019-01-18T02:15:18 Z gumball Pipes (BOI13_pipes) C++14
33.8889 / 100
1000 ms 132096 KB
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,m,i,a[101010],h[505050],ta,tb;
vector<ll> v[101010],w[101010];
ll dfs(ll aa,ll bb,ll cc)
{
	ll ii;
	for(ii=0;ii<v[aa].size();ii++)
	{
		if(w[aa][ii]==bb)continue;
		dfs(v[aa][ii],w[aa][ii],aa);
	}
	if(aa==1)
	{
		if(a[aa]!=0)
		{
			cout<<0<<"\n";
			exit(0);
		}
	}
	else
	{
		h[bb]=a[aa]*2;
		a[cc]-=a[aa];
		a[aa]-=0;
	}
}
int main()
{
	ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>m;
	for(i=1;i<=n;i++)cin>>a[i];
	for(i=1;i<=m;i++)
	{
		cin>>ta>>tb;
		v[ta].pb(tb);
		v[tb].pb(ta);
		w[ta].pb(i);
		w[tb].pb(i);
	}
	dfs(1,0,0);
	for(i=1;i<=m;i++)cout<<h[i]<<"\n";
}

Compilation message

pipes.cpp: In function 'long long int dfs(long long int, long long int, long long int)':
pipes.cpp:13:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(ii=0;ii<v[aa].size();ii++)
           ~~^~~~~~~~~~~~~
pipes.cpp:32:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 5112 KB Output is correct
2 Correct 5 ms 5112 KB Output is correct
3 Correct 6 ms 5240 KB Output is correct
4 Correct 92 ms 16124 KB Output is correct
5 Correct 5 ms 5112 KB Output is correct
6 Correct 5 ms 5112 KB Output is correct
7 Correct 5 ms 5112 KB Output is correct
8 Correct 5 ms 5112 KB Output is correct
9 Correct 6 ms 5240 KB Output is correct
10 Correct 6 ms 5240 KB Output is correct
11 Correct 6 ms 5240 KB Output is correct
12 Correct 6 ms 5240 KB Output is correct
13 Correct 73 ms 13904 KB Output is correct
14 Correct 97 ms 15480 KB Output is correct
15 Correct 88 ms 16360 KB Output is correct
16 Correct 76 ms 14456 KB Output is correct
17 Correct 102 ms 16120 KB Output is correct
18 Correct 105 ms 16120 KB Output is correct
19 Correct 153 ms 18296 KB Output is correct
20 Correct 6 ms 5112 KB Output is correct
21 Correct 6 ms 5240 KB Output is correct
22 Correct 126 ms 16120 KB Output is correct
23 Correct 107 ms 13816 KB Output is correct
24 Correct 136 ms 16124 KB Output is correct
25 Correct 103 ms 14328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 5112 KB Output isn't correct
2 Runtime error 155 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 658 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 336 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 197 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 503 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Incorrect 6 ms 5068 KB Output isn't correct
8 Runtime error 157 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Correct 6 ms 5112 KB Output is correct
10 Runtime error 108 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Runtime error 121 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
12 Runtime error 119 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
13 Runtime error 123 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
14 Runtime error 129 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
15 Runtime error 137 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Runtime error 153 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
17 Runtime error 148 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
18 Runtime error 152 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
19 Runtime error 123 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
20 Runtime error 114 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
21 Runtime error 113 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
22 Runtime error 129 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
23 Runtime error 730 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
24 Runtime error 983 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
25 Runtime error 967 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
26 Runtime error 850 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
27 Runtime error 401 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
28 Runtime error 182 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
29 Runtime error 421 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
30 Incorrect 146 ms 22776 KB Output isn't correct
31 Runtime error 763 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
32 Execution timed out 1093 ms 124464 KB Time limit exceeded
33 Runtime error 384 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
34 Runtime error 281 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
35 Runtime error 397 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
36 Runtime error 197 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
37 Runtime error 518 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
38 Runtime error 783 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
39 Execution timed out 1085 ms 85452 KB Time limit exceeded
40 Runtime error 795 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
41 Runtime error 701 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
42 Runtime error 611 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
43 Runtime error 712 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
44 Runtime error 235 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
45 Runtime error 332 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
46 Execution timed out 1084 ms 104504 KB Time limit exceeded
47 Runtime error 546 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
48 Runtime error 639 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
49 Correct 102 ms 15952 KB Output is correct
50 Runtime error 754 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
51 Correct 130 ms 17528 KB Output is correct
52 Runtime error 314 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
53 Runtime error 404 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)
54 Runtime error 784 ms 132096 KB Execution killed with signal 9 (could be triggered by violating memory limits)