# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472325 |
2021-09-13T11:46:55 Z |
MamdouhN |
Cipele (COCI18_cipele) |
C++14 |
|
1000 ms |
2616 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
vector<int>L,R;
main()
{
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
L.push_back(x);
}
for(int i=0;i<m;i++)
{
int x;
cin>>x;
R.push_back(x);
}
sort(L.begin(),L.end());
sort(R.begin(),R.end());
if(n>m)
{
swap(n,m);
swap(L,R);
}
int st=0,en=n-1;
int answer = 1e9;
while(en<=m-1)
{
int ans=0;
int j=st;
for(int i=0;i<n;i++)
{
int x = abs(L[i]-R[j]);
ans=max(ans,x);
j++;
}
answer = min(answer,ans);
st++;
en++;
}
cout<<answer<<endl;
}
Compilation message
cipele.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
8 | main()
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
76 ms |
2588 KB |
Output is correct |
2 |
Correct |
96 ms |
2616 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
104 ms |
2520 KB |
Output is correct |
2 |
Correct |
101 ms |
2488 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
7 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1046 ms |
2328 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1061 ms |
2360 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1074 ms |
2308 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |