QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#750297#7786. Graft and Transplants1ameseWA 0ms3636kbC++20441b2024-11-15 13:57:072024-11-15 13:57:07

Judging History

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

  • [2024-11-15 13:57:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2024-11-15 13:57:07]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int main() {
	int n;
	cin >> n;

	vector<int> g(n);
	for (int i = 0; i < n - 1; i++) {
		int u, v;
		cin >> u >> v;
		--u, --v;
		g[u]++, g[v]++;
	}

	for (int i = 0; i < n; i++) {
		if (g[i] == n - 1) {
			cout << "Bob\n";
			return 0;
		}
	}
	for (int i = 0; i < n; i++) {
		if ((n - 1 - g[i]) & 1) {
			cout << "Alice\n";
			return 0;
		}
	}

	cout << "Bob\n";
}

詳細信息

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Bob

result:

ok "Bob"

Test #4:

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

input:

3
1 2
1 3

output:

Bob

result:

ok "Bob"

Test #5:

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

input:

5
2 1
2 3
3 4
1 5

output:

Alice

result:

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