又是遍历~~
#include<bits/stdc++.h>
using namespace std;
double r;
struct node{vector<int> child;double value;
}t[100000];
double maxn=0;
int cnt=0;
void dfs(int root){for(int i=0;i<t[root].child.size();i++){t[t[root].child[i]].value=t[root].value*(1+0.01*r);if(t[t[root].child[i]].value>maxn){maxn=t[t[root].child[i]].value;cnt=0;}if(t[t[root].child[i]].value==maxn)cnt++;dfs(t[root].child[i]);}
}
int main(){int n;double p;cin>>n>>p>>r;int temp,root;for(int i=0;i<n;i++){cin>>temp;if(temp==-1)root=i;else t[temp].child.push_back(i);}if(n==1){printf("%.2f %d",p,1);return 0;}t[root].value=p;dfs(root);printf("%.2f %d",maxn,cnt);return 0;
}