code:
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
unordered_map<unsigned long long, unsigned long long> mp;
int n;
unsigned long long a[2009];
unsigned long long b[2009];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
for(int i = 1; i <= n; i++) {
cin >> b[i];
unordered_set<unsigned long long> st;
for(int j = 1; j <= n; j++) {
st.insert(b[i] * a[j] % mod);
}
for(auto it:st) {
mp[it]++;
}
}
unsigned long long maxn = 0;
for(auto it:mp) {
maxn = max(maxn, it.second);
}
cout << maxn;
return 0;
}
WA : #21−29 #31−40