# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
699353 |
2023-02-16T16:20:20 Z |
Uniq0rn |
Cipele (COCI18_cipele) |
C++14 |
|
42 ms |
2900 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define vi(x) vector<x>
#define pb push_back
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair
int main()
{
cin.tie(nullptr)->ios_base::sync_with_stdio(false);
int n,m;cin >> n >> m;
vector<int> a(n),b(m);
for(auto &e:a) cin >> e;
for(auto &e:b) cin >> e;
sort(all(a),greater<int>());sort(all(b),greater<int>());
if(n>m){
swap(a,b);
swap(n,m);
}
int l = 0,r = 1e9+10;
while(l < r){
int mid = (l+r)>>1;
int p = 0,ok = 1,i;
for(i=0;i<n;i++){
while(p<m && abs(a[i]-b[p]) > mid) p++;
if(p>m-1){
ok = 0;
break;
}
p++;
}
if(ok && i == n){
r = mid;
}
else{
l = mid+1;
}
}
cout << r;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
1108 KB |
Output is correct |
2 |
Correct |
38 ms |
2888 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
1108 KB |
Output is correct |
2 |
Correct |
39 ms |
2900 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
356 KB |
Output is correct |
2 |
Correct |
3 ms |
472 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
852 KB |
Output is correct |
2 |
Correct |
26 ms |
1804 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
980 KB |
Output is correct |
2 |
Correct |
17 ms |
2004 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
936 KB |
Output is correct |
2 |
Correct |
32 ms |
2508 KB |
Output is correct |