# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
779118 |
2023-07-11T08:04:32 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++17 |
|
1000 ms |
1884 KB |
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define int long long int
#define pb push_back
signed main(){
lalala;
int n,m;cin>>n>>m;
int sa[n],sol[m];
for(int i=0;i<n;i++)cin>>sa[i];
for(int i=0;i<m;i++)cin>>sol[i];
sort(sa,sa+n);
sort(sol,sol+m);
if(n==m){
int mx=0;
for(int i=0;i<n;i++)mx=max(mx,abs(sa[i]-sol[i]));
cout<<mx<<endl;
return 0;
}
if(n<m){
int mn=1000'000'000'000;
for(int i=0;i<m-n+1;i++){
int mx=0;
for(int j=i;j<i+n;j++){
mx=max(mx,abs(sa[j-i]-sol[j]));
}
mn=min(mn,mx);
}
cout<<mn<<endl;
}
else{
int mn=1000'000'000'000;
for(int i=0;i<n-m+1;i++){
int mx=0;
for(int j=i;j<i+m;j++){
mx=max(mx,abs(sa[j]-sol[j-i]));
}
mn=min(mx,mn);
}
cout<<mn<<endl;
return 0;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
1876 KB |
Output is correct |
2 |
Correct |
27 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1884 KB |
Output is correct |
2 |
Correct |
28 ms |
1876 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
1564 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
726 ms |
1688 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
1492 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |