# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
757278 | 2023-06-13T01:18:28 Z | racsosabe | Cipele (COCI18_cipele) | C++14 | 52 ms | 2856 KB |
#include<bits/stdc++.h> using namespace::std; const int N = 100000 + 5; int n; int m; int a[N]; int b[N]; bool can(int L) { int at = 1; for(int i = 1; i <= n; i++) { while(at <= m and b[at] < a[i] - L) at += 1; if(at <= m and b[at] <= a[i] + L) { at += 1; continue; } return false; } return true; } void swap() { for(int i = 1; i <= max(n, m); i++) swap(a[i], b[i]); swap(n, m); } int main(){ scanf("%d %d", &n, &m); for(int i = 1; i <= n; i++) scanf("%d", a + i); for(int i = 1; i <= m; i++) scanf("%d", b + i); if(n > m) swap(); sort(a + 1, a + n + 1); sort(b + 1, b + m + 1); int lo = 0, hi = 1000000000; while(lo < hi) { int mi = lo + (hi - lo) / 2; if(not can(mi)) lo = mi + 1; else hi = mi; } printf("%d\n", lo); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 2544 KB | Output is correct |
2 | Correct | 41 ms | 2832 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 2856 KB | Output is correct |
2 | Correct | 41 ms | 2852 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 420 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 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 | 340 KB | Output is correct |
2 | Correct | 2 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 2 ms | 412 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 3 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 2340 KB | Output is correct |
2 | Correct | 23 ms | 1748 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 2504 KB | Output is correct |
2 | Correct | 20 ms | 2108 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 52 ms | 2328 KB | Output is correct |
2 | Correct | 36 ms | 2588 KB | Output is correct |