#include "bits/stdc++.h"
#define pb(x) push_back(x)
#define fil(x, y) memset(x, y, sizeof(x))
#define ll long long
#define ff first
#define ss second
#define printp(x) x.ff << " " << x.ss
#define pii pair<int,int>
#define pll pair<long long,long long>
#define mp(x, y) make_pair(x,y)
#define inf 1073741823
#define infll 4611686018427387903
#define M 1000000007
#define db(x) cout << x << " ";
#define N 200007
#define sz size
#define sm 0.0000007
#define ins insert
#define ers erase
#define all(k) k.begin(), k.end()
#define cnt count
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
using namespace std;
int main()
{
fastio;
int n;
cin >> n;
int a[n];
int b[n];
for(int i = 0;i < n;i++)
{
cin >> a[i];
}
for(int i = 0;i < n;i++)
{
cin >> b[i];
}
vector <int> mn;
map <int, int> amio;
for(int i = 0;i < n;i++)
{
int x = b[i] - a[i];
if(amio[x] == 0)
mn.pb(x);
amio[x]++;
}
int mx = -inf;
for(int i = 0;i < mn.sz();i++)
{
mx = max(mx, amio[mn[i]]);
}
cout << mx << endl;
return 0;
}
Compilation message
jarvis.cpp: In function 'int main()':
jarvis.cpp:52:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
52 | for(int i = 0;i < mn.sz();i++)
| ~~^~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
19 ms |
1580 KB |
Output is correct |
3 |
Correct |
20 ms |
1484 KB |
Output is correct |
4 |
Correct |
19 ms |
1484 KB |
Output is correct |
5 |
Correct |
25 ms |
2372 KB |
Output is correct |
6 |
Correct |
26 ms |
2484 KB |
Output is correct |
7 |
Correct |
31 ms |
2500 KB |
Output is correct |
8 |
Correct |
30 ms |
2500 KB |
Output is correct |
9 |
Correct |
48 ms |
3000 KB |
Output is correct |
10 |
Correct |
49 ms |
2996 KB |
Output is correct |