# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
720586 | Ahmed57 | Mag (COCI16_mag) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//LCA
#include <bits/stdc++.h>
using namespace std;
signed main(){
cin>>n;
for(int i = 0;i<n-1;i++){
int a,b;cin>>a>>b;
adj[a].push_back(b);
adj[b].push_back(a);
}
long long mi = 1e18;
for(int i = 0;i<n;i++){
cin>>ma[i+1];
mi = min(mi,ma[i+1]);
}
calc(1,0);
dfs(1,0);
if(mi!=1)cout<<mi<<"/"<<1<<endl;
else cout<<2<<"/"<<2*maa+1<<endl;
}