#include <algorithm> #include <iostream> #include <vector> using namespace std; struct train { int num; // 列车车次(输入时的编号) int entryOrder; // 入栈顺序 }; // 比较函数,按照列车的车次(num)进行字典序排列 bool cmp(const struct train& t1, const struct train& t2) { return t1.num < ...