int FinaDestination(vector<vector<int> votes, int initialPoint)
{
int i = 0;
vector<bool> visited(votes.size(),false);
int dest = initialPoint;
while ( i < votes.size()) {
if (votes[i][1] == dest) {
if (visited[i] == true) {
return -1;
} else {
dest = votes[i][0];
visited[i] = true;
i = 0;
continue;
}
}
i++;
}
return dest;
}
tmet(learning c++)
最新推荐文章于 2022-11-14 14:11:06 发布