Submission #1965973


Source Code Expand

//Be Name Khoda
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma optimize O3
using namespace __gnu_pbds;
using namespace std;
template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T> using ordered_multiset =  tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long int LL;
typedef LL ll;
typedef long double ld;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef stringstream strs;
 
#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define ER(a) cout << #a << ' ' << a << endl
#define LB(a,n,x) (lower_bound(a,(a)+(n),x)-(a))
#define RET(x) { cout << x; exit(0); } 
#define RETD(x) { cout << fixed << setprecision(15) << x; exit(0); }
const ll M=2e5+5,LG=32,SM=600+5,inf=1e18+5;
ll mod=1e9+7;

ll n;
vll g[M];

ll dfs(ll x,ll p)
{
    ll res=0;
    for (ll y:g[x])
    {
        if (y==p) continue;
            res^=dfs(y,x)+1;
    }
    return res;
}

int main()
{
	ios::sync_with_stdio(0);
    cin >> n;
    For(i,1,n)
    {
        ll x,y;
        cin >> x >> y;
        x--;
        y--;
        g[x].PB(y);
        g[y].PB(x);
    }
    if (dfs(0,0)) RET("Alice");
    RET("Bob");      	
} 

Submission Info

Submission Time
Task D - Game on Tree
User hamid_k
Language C++14 (GCC 5.4.1)
Score 1100
Code Size 1554 Byte
Status AC
Exec Time 41 ms
Memory 12800 KB

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 4 ms 4992 KB
a10.txt AC 6 ms 5376 KB
a11.txt AC 6 ms 5376 KB
a12.txt AC 6 ms 5376 KB
a13.txt AC 38 ms 8704 KB
a14.txt AC 38 ms 8704 KB
a15.txt AC 31 ms 7936 KB
a16.txt AC 38 ms 8832 KB
a17.txt AC 39 ms 8832 KB
a18.txt AC 39 ms 8832 KB
a19.txt AC 38 ms 9472 KB
a2.txt AC 4 ms 4992 KB
a20.txt AC 40 ms 9728 KB
a21.txt AC 32 ms 8832 KB
a22.txt AC 39 ms 8704 KB
a23.txt AC 39 ms 8704 KB
a24.txt AC 31 ms 7936 KB
a25.txt AC 39 ms 8832 KB
a26.txt AC 40 ms 8832 KB
a27.txt AC 39 ms 8960 KB
a28.txt AC 39 ms 9472 KB
a29.txt AC 40 ms 9728 KB
a3.txt AC 5 ms 5120 KB
a30.txt AC 32 ms 8832 KB
a4.txt AC 6 ms 5376 KB
a5.txt AC 6 ms 5376 KB
a6.txt AC 6 ms 5376 KB
a7.txt AC 6 ms 5376 KB
a8.txt AC 6 ms 5376 KB
a9.txt AC 6 ms 5376 KB
b1.txt AC 41 ms 12800 KB
b2.txt AC 40 ms 10496 KB
b3.txt AC 41 ms 12800 KB
b4.txt AC 41 ms 10368 KB
b5.txt AC 40 ms 10368 KB
sample1.txt AC 3 ms 4992 KB
sample2.txt AC 3 ms 4992 KB
sample3.txt AC 3 ms 4992 KB
sample4.txt AC 3 ms 4992 KB