제출 #1168070

#제출 시각아이디문제언어결과실행 시간메모리
1168070Sir_Ahmed_Imran새로운 문제 (POI13_luk)C++20
20 / 100
80 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 = ans = 1; i < n; i++){ cin >> p >> q; a[p].append(q); a[q].append(p); } 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...