Submission #43986730


Source Code Expand

// LUOGU_RID: 117668696
#include <bits/stdc++.h>
#define SZ(x) (int) x.size() - 1
#define all(x) x.begin(), x.end()
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); i++)
#define DF(i, x, y) for (int i = (x); i >= (y); i--)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> void chkmax(T& x, T y) { x = max(x, y); }
template <typename T> void chkmin(T& x, T y) { x = min(x, y); }
template <typename T> void read(T &x) {
	x = 0; int f = 1; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
const int N = 2e5 + 10;
int n, sg[N];
vector <int> v[N];
void dfs(int x, int fa) {
	for (int i: v[x])
		if (i != fa) {
			dfs(i, x);
			sg[x] ^= sg[i] + 1;
		}
}
signed main() {
	read(n);
	F(i, 1, n - 1) {
		int x, y; read(x), read(y);
		v[x].push_back(y);
		v[y].push_back(x);
	}
	dfs(1, 0);
	puts(sg[1] ? "Alice" : "Bob");
	return 0;
}

Submission Info

Submission Time
Task D - Game on Tree
User ast123
Language C++ (GCC 9.2.1)
Score 1100
Code Size 1006 Byte
Status AC
Exec Time 53 ms
Memory 19532 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 1100 / 1100
Status
AC × 4
AC × 43
Set Name Test Cases
Sample sample1.txt, sample2.txt, sample3.txt, sample4.txt
All sample1.txt, sample2.txt, sample3.txt, sample4.txt, a1.txt, a10.txt, a11.txt, a12.txt, a13.txt, a14.txt, a15.txt, a16.txt, a17.txt, a18.txt, a19.txt, a2.txt, a20.txt, a21.txt, a22.txt, a23.txt, a24.txt, a25.txt, a26.txt, a27.txt, a28.txt, a29.txt, a3.txt, a30.txt, a4.txt, a5.txt, a6.txt, a7.txt, a8.txt, a9.txt, b1.txt, b2.txt, b3.txt, b4.txt, b5.txt, sample1.txt, sample2.txt, sample3.txt, sample4.txt
Case Name Status Exec Time Memory
a1.txt AC 12 ms 8248 KiB
a10.txt AC 12 ms 8728 KiB
a11.txt AC 11 ms 8768 KiB
a12.txt AC 9 ms 8648 KiB
a13.txt AC 36 ms 11852 KiB
a14.txt AC 29 ms 11752 KiB
a15.txt AC 29 ms 11032 KiB
a16.txt AC 42 ms 12216 KiB
a17.txt AC 36 ms 12172 KiB
a18.txt AC 35 ms 12028 KiB
a19.txt AC 45 ms 13436 KiB
a2.txt AC 10 ms 8164 KiB
a20.txt AC 38 ms 13600 KiB
a21.txt AC 28 ms 12540 KiB
a22.txt AC 36 ms 11840 KiB
a23.txt AC 30 ms 11872 KiB
a24.txt AC 31 ms 11208 KiB
a25.txt AC 42 ms 12096 KiB
a26.txt AC 32 ms 12236 KiB
a27.txt AC 36 ms 12216 KiB
a28.txt AC 37 ms 13388 KiB
a29.txt AC 53 ms 13692 KiB
a3.txt AC 9 ms 8404 KiB
a30.txt AC 36 ms 12532 KiB
a4.txt AC 11 ms 8540 KiB
a5.txt AC 12 ms 8460 KiB
a6.txt AC 11 ms 8540 KiB
a7.txt AC 12 ms 8568 KiB
a8.txt AC 12 ms 8620 KiB
a9.txt AC 16 ms 8568 KiB
b1.txt AC 46 ms 19352 KiB
b2.txt AC 40 ms 15664 KiB
b3.txt AC 35 ms 19532 KiB
b4.txt AC 39 ms 15628 KiB
b5.txt AC 37 ms 15608 KiB
sample1.txt AC 6 ms 8236 KiB
sample2.txt AC 9 ms 8240 KiB
sample3.txt AC 7 ms 8104 KiB
sample4.txt AC 6 ms 8276 KiB