# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
850417 |
2023-09-16T14:20:06 Z |
ipslp |
Cipele (COCI18_cipele) |
C++17 |
|
4 ms |
1624 KB |
#include <iostream>
#include <algorithm>
#include <fstream>
#include <cmath>
using namespace std;
int n, m;
const int dim = 1e4;///1e5+2
long long a[dim], b[dim];
long long modul( long long a )
{
if( a < 0 )
return -a;
else
return a;
}
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> m;
for( int i = 0; i < n; ++i )
{
cin >> a[i];
}
for( int j = 0; j < m; ++j )
{
cin >> b[j];
}
sort( a, a+n );
sort( b, b+m );
int dif, i, j;
if( n < m )
{
dif = m - n;
i = 0, j = m-1;
///primul vector este mic
while( dif > 0 )
{
if( modul(b[i] - a[0]) > modul( b[j]-a[n-1] ) )
{
++i;
--dif;
}
else
{
--j;
--dif;
}
}
//for( int k = i; k <= j; ++k )
//cout << b[k] << " ";
long long max_val = 0;
int z = 0;
for( int k = i; k <= j; ++k )
{
if( modul( b[k] - a[z] ) > max_val )
max_val = modul( b[k] - a[z] );
++z;
}
cout << max_val;
}
else
{
dif = n - m;
i = 0, j = n-1;
///al doilea vector este mic
while( dif > 0 )
{
if( modul(a[i] - b[0]) > modul( a[j]-b[m-1] ) )
{
++i;
--dif;
}
else
{
--j;
--dif;
}
}
long long max_val = 0;
int z = 0;
for( int k = i; k <= j; ++k )
{
if( modul( a[k] - b[z] ) > max_val )
max_val = modul( a[k] - b[z] );
++z;
}
cout << max_val;
//for( int k = i; k <= j; ++k )
//cout << a[k] << " ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
1112 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
1368 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
2 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
1624 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
1368 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
4 ms |
1368 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |