# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
81692 |
2018-10-26T08:00:42 Z |
Saboon |
Cipele (COCI18_cipele) |
C++14 |
|
55 ms |
5396 KB |
#include <iostream>
#include <sstream>
#include <queue>
#include <stack>
#include <vector>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <set>
#include <algorithm>
#include <iomanip>
#define F first
#define S second
#define PB push_back
#define PF push_front
#define MP make_pair
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int maxn = 1e5 + 37;
int a[maxn], b[maxn];
int n, m;
bool check (int x) {
int ptr = 1;
for (int i = 1; i <= n; i++) {
while (ptr <= m and abs (a[i] - b[ptr]) > x)
ptr ++;
if (ptr > m)
return false;
ptr ++;
}
return true;
}
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= m; i++)
cin >> b[i];
if (n > m) {
for (int i = 1; i <= n; i++) {
int tmp = a[i];
a[i] = b[i];
b[i] = tmp;
}
swap (n, m);
}
sort (a + 1, a + n + 1);
sort (b + 1, b + m + 1);
int lo = -1, hi = 1000 * 1000 * 1000;
while (hi - lo > 1) {
int mid = (hi + lo) >> 1;
if (check (mid))
hi = mid;
else
lo = mid;
}
cout << hi << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
2684 KB |
Output is correct |
2 |
Correct |
52 ms |
4448 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
5284 KB |
Output is correct |
2 |
Correct |
50 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5320 KB |
Output is correct |
2 |
Correct |
4 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
5320 KB |
Output is correct |
2 |
Correct |
5 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
5320 KB |
Output is correct |
2 |
Correct |
4 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
5320 KB |
Output is correct |
2 |
Correct |
5 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
5320 KB |
Output is correct |
2 |
Correct |
4 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
5320 KB |
Output is correct |
2 |
Correct |
30 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
5320 KB |
Output is correct |
2 |
Correct |
26 ms |
5320 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
5320 KB |
Output is correct |
2 |
Correct |
43 ms |
5396 KB |
Output is correct |