简单的深度优先搜索
#include <iostream>
#include <map>
#include <vector>
#include <climits>
using namespace std;
map<int,vector<int>> graph;
int minDepth;
int countMin=0;
using namespace std;
void dfs(int x,int depth){
if(graph[x].empty()){
if(depth<minDepth){
countMin=1;
minDepth=depth;
} else if(minDepth==depth){
countMin++;
}
}
for(int i:graph[x]){
dfs(i,depth+1);
}
}
int main() {
int N;
double P,r;
cin>>N>>P>>r;
minDepth=INT_MAX;
for (int i = 0; i < N; ++i) {
int num;
cin>>num;
for (int j = 0; j < num; ++j) {
int val;
cin>>val;
graph[i].push_back(val);
}
}
dfs(0,0);
int count=countMin;
int count1=minDepth;
r=r/100;
for (int i = 0; i < count1; ++i) {
P=P*(1+r);
}
printf("%.4f %d",P,count);
return 0;
}