Advertisement
_takumi

Buses_stops_2

Aug 6th, 2019
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <map>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main() {
  7.     map<vector<string>, int> m;
  8.     int q;
  9.     cin >> q;
  10.     for (int i = 0; i < q; i++) {
  11.         int n;
  12.         cin >> n;
  13.         vector<string> v;
  14.         for (int j = 0; j < n; j++) {
  15.             string stop;
  16.             cin >> stop;
  17.             v.push_back(stop);
  18.         }
  19.         if (m.count(v)) {
  20.             cout << "Already exists for " << m[v] << endl;
  21.         }
  22.         else {
  23.             int temp = m.size() + 1;
  24.             m[v] = temp;
  25.             cout << "New bus " << m[v] << endl;
  26.         }
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement