QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#293250#7786. Graft and Transplantucup-team191#WA 0ms1568kbC++14340b2023-12-29 02:38:252023-12-29 02:38:26

Judging History

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

  • [2023-12-29 02:38:26]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1568kb
  • [2023-12-29 02:38:25]
  • 提交

answer

#include <cstdio>

using namespace std;

const int N = 55;

int n, deg[N];

int main(){
	scanf("%d", &n);
	for(int i = 1;i < n;i++) {
		int a, b; scanf("%d%d", &a, &b);
		deg[a]++, deg[b]++;
	}
	int list = 0;
	for(int i = 1;i <= n;i++) list += deg[i] == 1;
	printf(((n - 1 - list) & 1) ? "Alice\n" : "Bob\n");
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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