func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   vector<pair<int, int> > v;   vector<int> tail;   int getIdx(int l, int r, int key) {     while (l < r) {       int mid = (l + r) / 2;       if (tail[mid] < key)         r = mid;       else         l = mid + 1;     }     return r;   }   int LIS() {     int length = 1;     tail[0] = v[0].second;     for (int i = 1; i < n; i++) {       if (v[i].second > tail[0])         tail[0] = v[i].second;       else if (v[i].second < tail[length - 1])         tail[length++] = v[i].second;       else {         tail[getIdx(0, length - 1, v[i].second)] = v[i].second;       }     }     return length;   }   int main() {     int x, y;     scanf( %d , &n);     v = vector<pair<int, int> >(n);     for (int i = 0; i < n; i++) {       scanf( %d , &x);       x--;       v[x].first = i;     }     for (int i = 0; i < n; i++) {       scanf( %d , &y);       y--;       v[y].second = i;     }     sort(v.begin(), v.end());     tail = vector<int>(n, 0);     cout << LIS();     return 0;   }   