#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
#define getar(ar,n) for(ll i=0;i<n;++i) cin>>ar[i]
#define show(n) cout<<n<<'\n'
#define all(v) v.begin(), v.end()
#define br cout<<"\n"
#define pb push_back
#define nl '\n'
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define ret return
#define ll long long
#define ld long double
#define sza(x) ((int)x.size())
const int mxN = 1e6 + 5;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ld EPS = 1e-9;
unordered_map<ll,ll> mp;
signed main() {
ll n;cin>>n;
vector<ll> a(n),b(n);
for(ll i=0;i<n;++i){
cin>>a[i];
a[i]+=mxN;
}
for(ll i=0;i<n;++i){
cin>>b[i];
b[i]+=mxN;
}
ll ans=0,mx=0;
for(ll i=0;i<n;++i){
if(b[i]==a[i])++ans;
else mx=max(++mp[b[i]-a[i]],mx);
}
show(ans+mx);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Correct |
22 ms |
1996 KB |
Output is correct |
3 |
Incorrect |
23 ms |
2004 KB |
Output isn't correct |
4 |
Correct |
22 ms |
1872 KB |
Output is correct |
5 |
Correct |
39 ms |
1872 KB |
Output is correct |
6 |
Correct |
42 ms |
2044 KB |
Output is correct |
7 |
Correct |
41 ms |
1872 KB |
Output is correct |
8 |
Correct |
40 ms |
1872 KB |
Output is correct |
9 |
Correct |
51 ms |
2376 KB |
Output is correct |
10 |
Correct |
48 ms |
2388 KB |
Output is correct |