Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Archit Singh
- //architsingh456@gmail.com
- //GitHub : archit-1997
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long int
- #define ld long double
- #define line cout<<"-------------"<<endl;
- #define F first
- #define S second
- #define P pair<ll,ll>
- #define PP pair<pair<ll,ll>,ll>
- #define V vector<ll>
- #define VP vector<pair<ll,ll>>
- #define VS vector<string>
- #define VV vector<vector<ll>>
- #define VVP vector<vector<pair<ll,ll>>>
- #define pb push_back
- #define pf push_front
- #define PQ priority_queue<ll>
- #define PQ_G priority_queue<ll,vector<ll>,greater<ll>>
- #define line cout<<"-------------"<<endl;
- #define mod 1000000007
- #define inf 1e18
- #define setbits(x) __builtin_popcount(x)
- #define zerobits(x) __builtin_ctzll(x)
- #define ps(x,y) fixed<<setprecision(y)<<x
- #define w(x) ll x; cin>>x; while(x--)
- #define FOR(i,a,b) for(ll i=a;i<b;i++)
- #define ma(arr,n,type) type *arr=new type[n]
- void init()
- {
- ios_base::sync_with_stdio(false);
- cin.tie(NULL); cout.tie(NULL);
- //freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- }
- int main()
- {
- init();
- ll n; cin >> n;
- V a(n, 0), b(n, 0), index(n, 0), left(n, 0), right(n, 0);
- FOR(i, 0, n)
- cin >> a[i];
- FOR(i, 0, n) {
- cin >> b[i];
- index[b[i]] = i;
- }
- FOR(i, 0, n) {
- ll diff = i - index[a[i]];
- if (diff < 0) {
- right[abs(diff)]++;
- left[n - abs(diff)]++;
- }
- else {
- left[diff]++;
- right[n - diff]++;
- }
- }
- cout << *max_element(right.begin(), right.end()) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement