# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
84396 | 2018-11-15T06:19:42 Z | wzy | Cipele (COCI18_cipele) | C++11 | 925 ms | 16396 KB |
#include <bits/stdc++.h> using namespace std; int n , m; vector<int> small, big; int32_t main(){ scanf("%d%d" , &n , &m); small.resize(n) , big.resize(m); for(int i = 0 ; i < n ;i ++){ scanf("%d" , &small[i]); } for(int i = 0 ; i < m ; i++){ scanf("%d" , &big[i]); } sort(small.begin() , small.end()); sort(big.begin() , big.end()); int l = 0 , r = 1000000000; if(small.size() > big.size()) swap(n,m) , swap(small , big); int ansj = -1; while(l<=r){ int mid = (l+r)/2; int can = true; multiset<int> mt; for(int i = 0 ; i < big.size() ; i++) mt.insert(big[i]); for(int i = 0 ; i < small.size() ; i++){ multiset<int>::iterator it = mt.lower_bound(small[i] - mid); if(it == mt.end()){ can = false; break; } int u = *it; if(abs(u - small[i]) <= mid){ mt.erase(it); continue; } else{ can = false; break; } } if(can){ ansj = mid; r = mid - 1; } else l = mid + 1; } printf("%d\n" , ansj); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 833 ms | 7416 KB | Output is correct |
2 | Correct | 914 ms | 9160 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 925 ms | 11344 KB | Output is correct |
2 | Correct | 887 ms | 12552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 12552 KB | Output is correct |
2 | Correct | 21 ms | 12552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 12552 KB | Output is correct |
2 | Correct | 20 ms | 12552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 12552 KB | Output is correct |
2 | Correct | 20 ms | 12552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 12552 KB | Output is correct |
2 | Correct | 20 ms | 12552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 12552 KB | Output is correct |
2 | Correct | 22 ms | 12552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 679 ms | 12552 KB | Output is correct |
2 | Correct | 321 ms | 12552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 561 ms | 12764 KB | Output is correct |
2 | Correct | 598 ms | 13504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 561 ms | 15140 KB | Output is correct |
2 | Correct | 643 ms | 16396 KB | Output is correct |