QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#303201#7786. Graft and TransplantDelay_for_five_minutesWA 1ms3448kbC++20421b2024-01-11 21:08:092024-01-11 21:08:10

Judging History

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

  • [2024-01-11 21:08:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3448kb
  • [2024-01-11 21:08:09]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define all(x) x.begin(),x.end()

const int N=53;
int n,x,y,d[N];
vector<int> e[N];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	for(int i=1;i<n;++i){
		cin>>x>>y,++d[x],++d[y];
	}
	int m=0;
	for(int i=1;i<=n;++i)m=max(m,d[i]);
	cout<<((n-m&1)?"Bob":"Alice")<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

score: 0
Accepted
time: 1ms
memory: 3448kb

input:

2
1 2

output:

Bob

result:

ok "Bob"

Test #4:

score: 0
Accepted
time: 1ms
memory: 3448kb

input:

3
1 2
1 3

output:

Bob

result:

ok "Bob"

Test #5:

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

input:

5
2 1
2 3
3 4
1 5

output:

Bob

result:

ok "Bob"

Test #6:

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

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

input:

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

output:

Bob

result:

ok "Bob"

Test #8:

score: -100
Wrong Answer
time: 1ms
memory: 3444kb

input:

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

output:

Alice

result:

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