QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#750222#7786. Graft and Transplants1ameseWA 0ms3848kbC++20330b2024-11-15 13:30:432024-11-15 13:30:43

Judging History

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

  • [2024-11-15 13:30:43]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-11-15 13:30:43]
  • 提交

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;
		}

	cout << "Alice\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Bob

result:

ok "Bob"

Test #4:

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

input:

3
1 2
1 3

output:

Bob

result:

ok "Bob"

Test #5:

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

input:

5
2 1
2 3
3 4
1 5

output:

Alice

result:

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