QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#282909#7786. Graft and TransplantLoging#WA 0ms1500kbC++20607b2023-12-13 14:17:092023-12-13 14:17:10

Judging History

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

  • [2023-12-13 14:17:10]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1500kb
  • [2023-12-13 14:17:09]
  • 提交

answer

#include<cstdio>
//struct E{
//	int a,b;
//}edge[M<<1];
//int tot,head[M];
//void Addedge(int a,int b){
//	edge[++tot].to=b;
//	edge[tot].nx=head[a];
//	head[a]=tot;
//}
#define M 1005
int Deg[M];
//void dfs(int now){
//	for(int i=head[now];i;i=edge[i].nx){
//		int nxt=edge[i].to;
//		if(nxt==fa[now])continue;
//		fa[nxt]=now;
//	}
//}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		Deg[a]++;Deg[b]++;
	}
	int cnt=n;
	for(int i=1;i<=n;i++){
		if(Deg[i]==1)cnt--;
	}
	if(cnt&1)puts("Bob");
	else puts("Alice");
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 1500kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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