# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
85431 |
2018-11-19T21:43:35 Z |
Vicktor |
Cipele (COCI18_cipele) |
C++14 |
|
1000 ms |
14012 KB |
#include <iostream>
#include <algorithm>
using namespace std;
int N,M;
long long A[100000],B[100000],K,T,F[100000],k,R;
long long Q(int q,int w)
{
if (q==N) {
R=0;
for (int i=0;i<k;i++) R=max(R,F[i]);
T=min(T,R);
} else {
for (int i=w;i<M;i++) {
K=A[q]-B[i];
if (K<0) K*=-1;
F[k]=K;
k++;
Q(q+1,i+1);
k--;
}
}
return 0;
}
int main()
{
cin.tie(0); ios_base::sync_with_stdio(0);
cin>>N>>M;
for (int i=0;i<N;i++) cin>>A[i];
for (int i=0;i<M;i++) cin>>B[i];
sort(A,A+N);
sort(B,B+M);
if (N==M) {
for (int i=0;i<N;i++) {
K=A[i]-B[i];
if (K<0) K*=-1;
T=max(K,T);
}
cout<<T;
} else {
T=10000000000000;
if (M<N) for (int i=0;i<N;i++) swap(A[i],B[i]);
Q(0,0);
cout<<T;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
3440 KB |
Output is correct |
2 |
Correct |
47 ms |
5232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
7232 KB |
Output is correct |
2 |
Correct |
46 ms |
8712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1065 ms |
8712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
8712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1080 ms |
8712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
8712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
8712 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1064 ms |
12120 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
13656 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1071 ms |
14012 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |