QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#768582#7786. Graft and TransplantmobbbWA 0ms3808kbC++20472b2024-11-21 12:38:212024-11-21 12:38:21

Judging History

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

  • [2024-11-21 12:38:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3808kb
  • [2024-11-21 12:38:21]
  • 提交

answer

#include <bits/stdc++.h>

#define ll long long

int main(){
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int n;
	std::cin >> n;
	std::vector<int> dag(n);

	for (int i = 0; i < n - 1; i++){
		int x, y;
		std::cin >> x >> y;
		x--, y--;
		dag[x]++, dag[y]++;
	}

	int ans = 0;
	for (int i = 0; i < n; i++){
		ans += (dag[i] == 1);
	}
	if (ans % 2 == 0){
		std::cout << "Alice\n";
	}else{
		std::cout << "Bob\n";
	}

	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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