# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
82436 |
2018-10-30T17:44:14 Z |
diegogrc |
Cipele (COCI18_cipele) |
C++17 |
|
54 ms |
11484 KB |
// Copyright © 2018 Diego Garcia Rodriguez del Campo. All rights reserved.
#include<bits/stdc++.h>
#define MAX 200005
#define INF 1e10
#define optimiza_io cin.tie(0); ios_base::sync_with_stdio(0);
using namespace std;
typedef long long i64;
i64 N, M;
i64 a[MAX];
i64 b[MAX];
bool canDo( i64 x )
{
i64 cnt = 1;
for( i64 i = 1; i <= N; i ++ )
{
while( cnt <= M && abs( b[cnt] - a[i] ) > x )
cnt++;
if( cnt > M )
return false;
cnt++;
}
return true;
}
int main()
{
optimiza_io
cin >> N >> M;
if( N < M )
{
for( i64 i = 1; i <= N; i ++ )
cin >> a[i];
for( i64 i = 1; i <= M; i ++ )
cin >> b[i];
}
else
{
for( i64 i = 1; i <= N; i ++ )
cin >> b[i];
for( i64 i = 1; i <= M; i ++ )
cin >> a[i];
swap( N , M );
}
sort( a + 1 , a + N + 1 );
sort( b + 1 , b + M + 1 );
i64 ini = 0;
i64 fin = INF;
while( ini < fin )
{
i64 mid = ( ini + fin ) / 2;
if( canDo( mid ) )
fin = mid;
else
ini = mid + 1;
}
cout << ini << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
3448 KB |
Output is correct |
2 |
Correct |
49 ms |
5420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
54 ms |
7208 KB |
Output is correct |
2 |
Correct |
50 ms |
8768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8768 KB |
Output is correct |
2 |
Correct |
4 ms |
8768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8768 KB |
Output is correct |
2 |
Correct |
4 ms |
8768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
8768 KB |
Output is correct |
2 |
Correct |
4 ms |
8768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
8768 KB |
Output is correct |
2 |
Correct |
4 ms |
8768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
8768 KB |
Output is correct |
2 |
Correct |
6 ms |
8768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
8768 KB |
Output is correct |
2 |
Correct |
36 ms |
8768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
8768 KB |
Output is correct |
2 |
Correct |
29 ms |
8768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
9936 KB |
Output is correct |
2 |
Correct |
49 ms |
11484 KB |
Output is correct |