QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#790630#7786. Graft and Transplantzhilin#WA 1ms3760kbC++14345b2024-11-28 14:11:502024-11-28 14:11:52

Judging History

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

  • [2024-11-28 14:11:52]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3760kb
  • [2024-11-28 14:11:50]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long

int a[333];
using namespace std;
int main(){
	int n;cin>>n;
	for(int i=1;i<n;i++)
	{
		int u,v;
		cin>>u>>v;
		a[u]++;
		a[v]++;			
	}	
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]==1)ans++;
	}
	if((n-1-ans)%2)
	{
		printf("Alice");
	}
	else printf("Bob");

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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