Advertisement
Saleh127

codeforces 1365C.cpp

Jun 8th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define Faster ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  4. int x,n,a[200005],c[200005],d[200005],e,f=0,i,j,k,l;
  5. int main ()
  6. {
  7. Faster
  8. cin>>n;
  9. for(i=1;i<=n;i++)
  10. {
  11. cin>>x;
  12. a[x]=i;
  13. }
  14. for(i=1;i<=n;i++)
  15. {
  16. cin>>x;
  17. c[x]=i;
  18. }
  19. for(j=1;j<=n;j++)
  20. {
  21. e=c[j]-a[j];
  22. if(e<0) e+=n;
  23. d[e]++;
  24. }
  25. for(j=0;j<=n;j++)
  26. {
  27. f=max(f,d[j]);
  28. }
  29. cout<<f<<endl;
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement