제출 #1168075

#제출 시각아이디문제언어결과실행 시간메모리
1168075Sir_Ahmed_ImranTriumphal arch (POI13_luk)C++20
30 / 100
81 ms19524 KiB
            //    01001100 01001111 01010100 01000001    \\
            //                                           \\
            //                ╦  ╔═╗╔╦╗╔═╗               \\
            //                ║  ║ ║ ║ ╠═╣               \\
            //                ╩═╝╚═╝ ╩ ╩ ╩               \\
            //                                           \\
            //    01001100 01001111 01010100 01000001    \\

#include <bits/stdc++.h>
using namespace std;
#define N 300001
#define nl '\n'
#define ff first
#define ss second
#define add insert
#define ll long long
#define ld long double
#define terminator main
#define pll pair<ll,ll>
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

int ans;
int dp[N];
int dept[N];
vector<int> a[N];

void dfs(int v, int u){
    dept[v] = dept[u] + 1;
    dp[v] = dp[u] + a[v].size() - 1;
    ans = max(ans, (dp[v] + dept[v] - 1) / dept[v]);
    for(auto & i : a[v]) if(i != u) dfs(i, v);
}

void solve(){
    int n, p, q;
    cin >> n;
    a[1].append(0);
    for(int i = 1; i < n; i++){
        cin >> p >> q;
        a[p].append(q);
        a[q].append(p);
    }
    ans = 0;
    dfs(1, 0);
    cout << ans;
}

int terminator(){
    L0TA;
    solve();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...