-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoutput1
34 lines (31 loc) · 1.09 KB
/
output1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
vector<int> Amplifier_by_Edges(vector<Edge*> &paths,int start){ //////用边数组和起始位置计算放大器
vector<int> ans;
int res_D = Edge::D;
for(Edge* &path:paths){
if(path->edge_d > res_D){ ///////如果不行就加放大器
ans.push_back(start);
res_D = Edge::D;
}
else{ ////////////减去d
res_D -= path->edge_d;
}
if(start==path->edge_node1_id){ //////////确定下一个位置的起点
start = path->edge_node2_id;
}
else{
start = path->edge_node1_id; ///////////确定
}
}
return ans;
}
void output_test1(int tunnel_id, vector<Edge*> &paths, int start){ //////输入格式为1、通道id 2、边(数组) 3、起始点
vector<int> Amplifier_array = Amplifier_by_Edges(paths,start);
cout<<tunnel_id<<paths.size()<<Amplifier_array.size();
for(Edge* &path:paths){
cout<<path;
}
for(int amplifier:Amplifier_array){
cout<<amplifier;
}
cout<<endl;
}