QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#391149#7786. Graft and TransplantUnknown1508WA 1ms3808kbC++14466b2024-04-16 14:07:042024-04-16 14:07:04

Judging History

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

  • [2024-04-16 14:07:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3808kb
  • [2024-04-16 14:07:04]
  • 提交

answer

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

void main_program();

signed main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	main_program();
}

void main_program(){
	int n; cin >> n;
	vector<int> v(n);

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

	int cnt = 0;
	for (int i = 0; i < n; i++) cnt += (v[i] == 1);

	int rem = n - cnt;
	if (rem % 2) cout << "Bob\n";
	else cout << "Alice\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3592kb

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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