QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#362542#7786. Graft and TransplantSunlight9#WA 1ms3608kbC++14514b2024-03-23 16:02:292024-03-23 16:02:30

Judging History

你现在查看的是最新测评结果

  • [2024-03-23 16:02:30]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3608kb
  • [2024-03-23 16:02:29]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define rep(i,t,n) for (int i=t;i<=n;i++)
#define endl '\n'
using namespace std;
int n;
int d[55];
signed main(){
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	ios::sync_with_stdio(false);
    cout.tie(0);cin.tie(0);
	cin>>n;
	for (int i=1;i<n;i++){
		int u,v;
		cin>>u>>v;
		d[u]++,d[v]++;
	}
	int sum=0;
	for (int i=1;i<=n;i++) 
		sum+=(d[i]!=1); 
	if (sum%2==1) cout<<"Bob"<<endl;
	else cout<<"Alice"<<endl;
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3568kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3604kb

input:

2
1 2

output:

Alice

result:

wrong answer 1st words differ - expected: 'Bob', found: 'Alice'