func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, k;   vector<vector<int> > Dist, Alist;   vector<int> Distance, GivenPath;   int mi, ma;   bool isThere(int u, vector<int>& alist) {     for (auto e : alist) {       if (e == u) return true;     }     return false;   }   int main() {     cin >> n >> m;     vector<int> Alist[n];     vector<int> Alist2[n];     vector<int> Dist[n + 5];     int Distance[n];     memset(Distance, -1, sizeof(Distance));     for (int i = 0 - (0 > m); i != m - (0 > m); i += 1 - 2 * (0 > m)) {       int u, v;       cin >> u >> v, u--, v--;       Alist[v].push_back(u);       Alist2[u].push_back(v);     }     cin >> k;     GivenPath.assign(k, 0);     for (int i = 0 - (0 > k); i != k - (0 > k); i += 1 - 2 * (0 > k))       cin >> GivenPath[i], GivenPath[i]--;     mi = ma = 0;     Distance[GivenPath.back()] = 0;     Dist[0].push_back(GivenPath.back());     queue<int> q;     q.push(GivenPath.back());     while (!q.empty()) {       int u = q.front();       q.pop();       for (auto& e : Alist[u]) {         if (Distance[e] == -1) {           Distance[e] = Distance[u] + 1;           Dist[Distance[e]].push_back(e);           q.push(e);         }       }     }     for (int i = 0 - (0 > k - 1); i != k - 1 - (0 > k - 1);          i += 1 - 2 * (0 > k - 1)) {       int dist = Distance[GivenPath[i]] - 1;       if (dist != Distance[GivenPath[i + 1]]) {         mi++, ma++;         continue;       }       for (auto e : Alist2[GivenPath[i]]) {         if (e != GivenPath[i + 1] && Distance[e] == dist) {           ma++;           break;         }       }     }     cout << mi <<     << ma <<   n ;     return 0;   }   