QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#679227#7786. Graft and Transplantsurenjamts#WA 0ms3676kbC++17511b2024-10-26 17:10:442024-10-26 17:10:45

Judging History

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

  • [2024-10-26 17:10:45]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3676kb
  • [2024-10-26 17:10:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define F first
#define S second
vector <int> adj[247];
signed main(){
	int n, a, b;
	cin >> n;
	for(int i = 1; i < n; i ++ ){
		cin >> a >> b;
		adj[a].pb( b );
		adj[b].pb( a );
	}
	int leaf = 0;
	for(int i = 1; i <= n; i ++ ){
		if( adj[i].size() == 1 )
			leaf ++;
	}
	if( n != 4 ){
		cout << "Bob\n";
		return 0;
	}
	if( (n-leaf)%2 == 0 ){
		cout << "Alice\n";
	}else
		cout << "Bob\n";
}

详细

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Bob

result:

ok "Bob"

Test #4:

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

input:

3
1 2
1 3

output:

Bob

result:

ok "Bob"

Test #5:

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

input:

5
2 1
2 3
3 4
1 5

output:

Bob

result:

ok "Bob"

Test #6:

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

input:

6
4 3
4 2
4 5
4 1
4 6

output:

Bob

result:

ok "Bob"

Test #7:

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

input:

7
2 4
4 1
1 5
5 3
3 7
7 6

output:

Bob

result:

ok "Bob"

Test #8:

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

input:

8
2 3
3 1
3 6
7 6
6 5
7 8
6 4

output:

Bob

result:

ok "Bob"

Test #9:

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

input:

9
1 3
1 4
4 2
3 7
5 7
5 6
1 9
9 8

output:

Bob

result:

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