# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
855718 |
2023-10-01T17:06:17 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++17 |
|
72 ms |
2844 KB |
#include <bits/stdc++.h>
using namespace std;
#define sp << " " <<
#define int long long
#define vi vector<int>
#define pb push_back
#define F(xxx,yyy) for (int xxx=1;xxx<=yyy;xxx++)
#define pii pair<int,int>
#define all(x) x.begin()+1,x.end()
const int N = 4e5+1;
void solve() {
int n,m;
cin >> n >> m;
vi a(n+1),b(m+1);
F(i,n) cin >> a[i];
F(i,m) cin >> b[i];
sort(a.begin(),a.end());
sort(b.begin(),b.end());
if (a.size() > b.size()) swap(a,b),swap(n,m);
int l = 0;
int r = 1e9;
while (l<=r) {
int x = (l+r) >> 1;
int ptr2 = 1;
stack<int> s;
int fl = 1;
for (int i=1;i<=n;i++) {
while (ptr2<=m && (s.empty() || s.top() < a[i]-x)) s.push(b[ptr2++]);
if (s.top() >= a[i]-x && s.top() <= a[i]+x) continue;
fl = 0;
break;
}
if (fl) r = x-1;
else l = x+1;
}
cout << l << endl;
}
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int t = 1;
//cin >> t;
while (t --> 0) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
2844 KB |
Output is correct |
2 |
Incorrect |
72 ms |
2828 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
2836 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
3 |
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 |
Incorrect |
2 ms |
348 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 |
Incorrect |
56 ms |
2568 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
2600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
61 ms |
2684 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |