Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <string>
- #include <map>
- using namespace std;
- int main(){
- int c,qty=0;
- string stop;
- vector<string> stops;
- int busnum=0;
- cin>>c;
- map <int, vector<string>> bus_path;
- map <vector<string>, int> bus_path_rev;
- for (int i=0;i<c;i++){
- cin >> qty;
- for (int y=0;y<qty;y++){
- cin >> stop;
- stops.push_back(stop);
- stop="";
- }
- if (bus_path_rev.count(stops)<1){
- busnum++;
- bus_path[busnum]=stops;
- bus_path_rev[stops]=busnum;
- cout <<"New bus "<<busnum << endl;
- stops.clear();
- }
- else {
- int bbus;
- bbus = bus_path_rev[stops];
- cout << "Already exists for " << bbus << endl;
- for (auto x : bus_path_rev){
- for (auto y: x.first() ){
- cout << y << " ";
- }
- cout << endl<< x.second();
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement