#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
#define coy cout<<"YES\n"
#define con cout<<"NO\n"
#define co1 cout<<"-1\n"
#define sc(x) scanf("%lld",&x)
#define all(x) x.begin(),x.end()
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int SI=3e5+7;
ll INF=8e18+7;
int dx[] = {1 , -1 , 0 , 0};
int dy[] = {0 , 0 , 1 , -1};
int MOD=1e9+7;
ll n,m,a[SI],b[SI];
int main()
{
fast
cin>>n>>m;
for (int i=0;i<n;i++)
cin>>a[i];
for (int i=0;i<n;i++)
cin>>b[i];
sort(a,a+n);
sort (b,b+n);
ll ans =0;
for (int i=0;i<n;i++)
ans=max(ans,abs(a[i]-b[i]));
cout<<ans <<"\n";
// use scanf not cin
return 0;
}
Compilation message
cipele.cpp: In function 'int main()':
cipele.cpp:30:4: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
30 | for (int i=0;i<n;i++)
| ^~~
cipele.cpp:32:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
32 | cout<<ans <<"\n";
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
3356 KB |
Output is correct |
2 |
Correct |
45 ms |
3784 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
3664 KB |
Output is correct |
2 |
Correct |
37 ms |
3656 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Incorrect |
2 ms |
464 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
464 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
2736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
3112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
2624 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |