Submission #2159199


Source Code Expand

//Be Name Khoda
/*
tane adami sharifast be jane adamiat
na hamin lebase zibast neshane adamiat
agar adami be cheshmasto dahano goosho bini
che miane naghshe divaro miane adamiat
khoro khabo khashmo shahvat shaghab asto jahlo zolmat
hayavan khabar nadarad ze jahane adamiat
be haghighat adami bash vagarna morgh bashad
ke hami sokhan begooyad be zabane adamiat
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
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 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 MKP make_pair
#define RETD(x) { cout << fixed << setprecision(15) << x; } //exit(0); }
#define GEI(x) scanf("%d",&x)
#define GEL(x) scanf("%lld",&x)
#define ALL(x) x.begin(),x.end()
const ll M=5e4+5,LG=32,SM=2e4+5,inf=1e9+5;
ll mod=1e9+7;
#define MOK(x) if(x>mod) x-=mod;
ll pw(ll x,ll n) { return (n==0?1:pw(x*x%mod,n/2)*(n&1?x:1)%mod); }

ll n;
vll g[M];
ll cm[M],cn[M];
ll res;

ll lasb(ll x) { return (x<2?x:lasb(x>>1)+1); }
ll firb(ll x) { return (x&1?0:firb(x>>1)+1); }

void dfs(ll x,ll p)
{
    ll ba=0;
    for (ll y:g[x])
    {
        if (y==p) continue;
        dfs(y,x);
        ba|=cm[x]&cm[y];
        cm[x]|=cm[y];
    }
    ll nd=lasb(ba);
    cm[x]&=-(1<<nd);
    cm[x]+=(1<<nd);
    cn[x]=firb(cm[x]);
    smax(res,cn[x]);
}
 
int main()
{
	ios::sync_with_stdio(0);
    cin >> n;
    For(i,1,n)
    {
        ll a,b;
        cin >> a >> b;
        a--;b--;
        g[a].PB(b);g[b].PB(a);
    }
    dfs(0,0);
    RET(res);
} 

Submission Info

Submission Time
Task D - Uninity
User hamid_k
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2325 Byte
Status RE
Exec Time 101 ms
Memory 4864 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1400
Status
AC × 2
AC × 14
RE × 60
Set Name Test Cases
Sample s1.txt, s2.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, 45.txt, 46.txt, 47.txt, 48.txt, 49.txt, 50.txt, 51.txt, 52.txt, 53.txt, 54.txt, 55.txt, 56.txt, 57.txt, 58.txt, 59.txt, 60.txt, 61.txt, 62.txt, 63.txt, 64.txt, 65.txt, 66.txt, 67.txt, 68.txt, 69.txt, 70.txt, 71.txt, 72.txt, s1.txt, s2.txt
Case Name Status Exec Time Memory
01.txt RE 97 ms 1408 KB
02.txt RE 98 ms 1408 KB
03.txt RE 97 ms 1408 KB
04.txt RE 96 ms 1408 KB
05.txt RE 96 ms 1408 KB
06.txt RE 96 ms 1408 KB
07.txt RE 96 ms 1408 KB
08.txt RE 97 ms 1408 KB
09.txt RE 97 ms 1408 KB
10.txt RE 96 ms 1408 KB
11.txt AC 14 ms 4736 KB
12.txt AC 14 ms 4864 KB
13.txt RE 99 ms 1408 KB
14.txt RE 97 ms 1408 KB
15.txt RE 96 ms 1408 KB
16.txt RE 96 ms 1408 KB
17.txt RE 97 ms 1408 KB
18.txt RE 96 ms 1408 KB
19.txt RE 96 ms 1408 KB
20.txt RE 96 ms 1408 KB
21.txt RE 97 ms 1408 KB
22.txt RE 96 ms 1408 KB
23.txt RE 96 ms 1408 KB
24.txt RE 96 ms 1408 KB
25.txt RE 97 ms 1408 KB
26.txt RE 98 ms 1408 KB
27.txt RE 96 ms 1408 KB
28.txt RE 97 ms 1408 KB
29.txt RE 97 ms 1408 KB
30.txt RE 101 ms 1408 KB
31.txt RE 97 ms 1408 KB
32.txt RE 96 ms 1408 KB
33.txt RE 97 ms 1408 KB
34.txt RE 96 ms 1408 KB
35.txt RE 97 ms 1408 KB
36.txt RE 97 ms 1408 KB
37.txt RE 97 ms 1408 KB
38.txt RE 97 ms 1408 KB
39.txt RE 96 ms 1408 KB
40.txt RE 97 ms 1408 KB
41.txt RE 97 ms 1408 KB
42.txt RE 97 ms 1408 KB
43.txt RE 97 ms 1408 KB
44.txt RE 96 ms 1408 KB
45.txt RE 96 ms 1408 KB
46.txt RE 96 ms 1408 KB
47.txt RE 96 ms 1408 KB
48.txt RE 96 ms 1408 KB
49.txt RE 97 ms 1408 KB
50.txt RE 96 ms 1408 KB
51.txt RE 98 ms 1408 KB
52.txt RE 96 ms 1408 KB
53.txt RE 96 ms 1408 KB
54.txt RE 96 ms 1408 KB
55.txt RE 97 ms 1408 KB
56.txt RE 96 ms 1408 KB
57.txt RE 97 ms 1408 KB
58.txt RE 97 ms 1408 KB
59.txt RE 97 ms 1408 KB
60.txt RE 96 ms 1408 KB
61.txt RE 97 ms 1408 KB
62.txt RE 96 ms 1408 KB
63.txt AC 2 ms 1408 KB
64.txt AC 2 ms 1408 KB
65.txt AC 2 ms 1408 KB
66.txt AC 2 ms 1408 KB
67.txt AC 2 ms 1408 KB
68.txt AC 2 ms 1408 KB
69.txt AC 2 ms 1408 KB
70.txt AC 2 ms 1408 KB
71.txt AC 2 ms 1408 KB
72.txt AC 2 ms 1408 KB
s1.txt AC 2 ms 1408 KB
s2.txt AC 2 ms 1408 KB