# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95200 | 2019-01-28T13:56:44 Z | Ort | Cipele (COCI18_cipele) | C++11 | 46 ms | 2936 KB |
#include<algorithm> #include<iostream> #include<vector> #include<cmath> using namespace std; int main() { cin.sync_with_stdio(0); cin.tie(0); cin.exceptions(cin.failbit); int n, m; cin >> n >> m; vector<int> a(n), b(m); for(int i=0;i<n;i++) cin >> a[i]; for(int i=0;i<m;i++) cin >> b[i]; sort(a.begin(),a.end()); sort(b.begin(),b.end()); if(n>m) swap(a,b); int low = -1, high = 1e9, mid, t; bool valid; while(high-low>1) { mid = (low+high)>>1; t = 0; valid = 1; for(int i=0;i<a.size();i++) { if(t>=b.size()) { valid = 0; break; } while(t<b.size() && b[t]<=a[i] && a[i]-b[t]>mid) t++; if(t>=b.size() || abs(a[i]-b[t])>mid) { valid = 0; break; } t++; } if(valid) high = mid; else low = mid; } cout << high; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 2808 KB | Output is correct |
2 | Correct | 46 ms | 2936 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 2936 KB | Output is correct |
2 | Correct | 42 ms | 2936 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 2424 KB | Output is correct |
2 | Correct | 26 ms | 1784 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 2680 KB | Output is correct |
2 | Correct | 27 ms | 2056 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 40 ms | 2396 KB | Output is correct |
2 | Correct | 37 ms | 2576 KB | Output is correct |