QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#352304#7786. Graft and TransplantOccDreamer#WA 1ms3668kbC++141.4kb2024-03-13 08:55:012024-03-13 08:55:03

Judging History

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

  • [2024-03-13 08:55:03]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3668kb
  • [2024-03-13 08:55:01]
  • 提交

answer

//code by Emissary
#include<bits/stdc++.h>

#define fi first
#define se second
#define vc vector
#define db double
#define ll long long
#define mk make_pair
#define pb push_back
#define PI pair<int,int>
#define ull unsigned long long
#define err cerr << "   -_-   " << endl
#define debug cerr << " ------------------- " << endl

#define input(x) freopen(#x".in","r",stdin)
#define output(x) freopen(#x".out","w",stdout)

#define NO puts("No")
#define YES puts("Yes")

//#define int long long

using namespace std;

namespace IO{
	inline int read(){
		int X=0, W=0; char ch=getchar();
		while(!isdigit(ch)) W|=ch=='-', ch=getchar();
		while(isdigit(ch)) X=(X<<1)+(X<<3)+(ch^48), ch=getchar();
		return W?-X:X;
	}
	inline void write(int x){
		if(x<0) x=-x, putchar('-');
		if(x>9) write(x/10);
		putchar(x%10+'0');
	}
	inline void sprint(int x){write(x), putchar(32);}
	inline void eprint(int x){write(x), putchar(10);}
}using namespace IO;

const int MAXN = 5e5+5;
const int mod = 998244353;
//const int mod = 1e9+7;

int n, du[MAXN];

signed main(){
	n=read();
	for(int i=2;i<=n;++i){
		int x, y;
		x=read(), y=read();
		du[x]++; du[y]++;
	}
	int tot=0;
	for(int i=1;i<=n;++i) tot+=du[i]!=1;
	if(tot&1) cout << "Bob";
	else cout << "Alice";
	return 0;
}





































































详细

Test #1:

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

input:

4
1 2
2 3
3 4

output:

Alice

result:

ok "Alice"

Test #2:

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

input:

4
1 2
1 3
1 4

output:

Bob

result:

ok "Bob"

Test #3:

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

input:

2
1 2

output:

Alice

result:

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