QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#750292#7786. Graft and Transplants1ameseWA 0ms3604kbC++20341b2024-11-15 13:55:492024-11-15 13:55:50

Judging History

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

  • [2024-11-15 13:55:50]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3604kb
  • [2024-11-15 13:55:49]
  • 提交

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 ((n - 1 - g[i]) & 1) {
			cout << "Alice\n";
			return 0;
		}
	}

	cout << "Bob\n";
}

Details

Tip: Click on the bar to expand more detailed information

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: 3596kb

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Bob

result:

ok "Bob"

Test #4:

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

input:

3
1 2
1 3

output:

Alice

result:

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