SHARE
TWEET

Untitled

a guest Jul 24th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4. #include <map>
  5. using namespace std;
  6.  
  7. int main(){
  8.     int c,qty=0;
  9.     string stop;
  10.     vector<string> stops;
  11.     int busnum=0;
  12.     cin>>c;
  13.     map <int, vector<string>> bus_path;
  14.     map <vector<string>, int> bus_path_rev;
  15.  
  16.     for (int i=0;i<c;i++){
  17.         cin >> qty;
  18.         for (int y=0;y<qty;y++){
  19.             cin >> stop;
  20.             stops.push_back(stop);
  21.             stop="";
  22.         }
  23.  
  24.         if (bus_path_rev.count(stops)<1){
  25.             busnum++;
  26.             bus_path[busnum]=stops;
  27.             bus_path_rev[stops]=busnum;
  28.             cout <<"New bus "<<busnum << endl;
  29.             stops.clear();
  30.         }
  31.         else {
  32.             int bbus;
  33.             bbus = bus_path_rev[stops];
  34.             cout << "Already exists for " << bbus << endl;
  35.  
  36.             for (auto x : bus_path_rev){
  37.                 for (auto y: x.first() ){
  38.                     cout << y << " ";
  39.                 }
  40.                 cout << endl<< x.second();
  41.  
  42.                 }
  43.  
  44.         }
  45.  
  46.     }
  47.  
  48. return 0;
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top