# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
306420 |
2020-09-25T13:22:05 Z |
colazcy |
Cipele (COCI18_cipele) |
C++17 |
|
44 ms |
1272 KB |
#include <cstdio>
#include <cctype>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 1e5 + 100;
inline int read(){
int x = 0;char c = getchar();
while(!isdigit(c))c = getchar();
while(isdigit(c))x = x * 10 + c - '0',c = getchar();
return x;
}
int va[maxn],vb[maxn];
inline bool check(int limit){
int pos = 1;
for(int i = 1;i <= vb[0];i++){
while(pos <= va[0] && abs(va[pos] - vb[i]) > limit)pos++;
if(pos == va[0] + 1)return false;
pos++;
}
return true;
}
int main(){
va[0] = read(),vb[0] = read();
for(int i = 1;i <= va[0];i++)va[i] = read();
for(int i = 1;i <= vb[0];i++)vb[i] = read();
if(va[0] < vb[0])swap(va,vb);
sort(va + 1,va + 1 + va[0]);
sort(vb + 1,vb + 1 + vb[0]);
int l = 0,r = max(abs(va[1] - vb[vb[0]]),abs(vb[1] - va[va[0]])),ans = -1;
while(l <= r){
int mid = (l + r) >> 1;
if(check(mid))ans = mid,r = mid - 1;
else l = mid + 1;
}
printf("%d\n",ans);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
28 ms |
1024 KB |
Output is correct |
2 |
Correct |
43 ms |
1124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
1024 KB |
Output is correct |
2 |
Correct |
44 ms |
1016 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1024 KB |
Output is correct |
2 |
Correct |
3 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1024 KB |
Output is correct |
2 |
Correct |
3 ms |
1056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1024 KB |
Output is correct |
2 |
Correct |
3 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1024 KB |
Output is correct |
2 |
Correct |
3 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1024 KB |
Output is correct |
2 |
Correct |
3 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
44 ms |
1144 KB |
Output is correct |
2 |
Correct |
27 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
1024 KB |
Output is correct |
2 |
Correct |
20 ms |
896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
1272 KB |
Output is correct |
2 |
Correct |
37 ms |
928 KB |
Output is correct |