# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
779221 |
2023-07-11T09:11:10 Z |
vjudge1 |
Cipele (COCI18_cipele) |
C++17 |
|
1000 ms |
2640 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);
#define OYY 1000000005
#define mod 998244353
vector <int> v,t;
int n,m;
bool c(int x) {
int pos=1;
for (int i=1;i<=n;i++) {
int q=lower_bound(t.begin()+pos,t.begin()+m+1,v[i]-x)-t.begin();
if (q==m+1)return false;
if (abs(t[q]-v[i])>x) return false;
pos=q+1;
}
return true;
}
int32_t main(){
faster
cin>>n>>m;
int deg;
for(int i=0;i<n;i++){
cin>>deg;
v.push_back(deg);
}
for(int i=0;i<m;i++){
cin>>deg;
t.push_back(deg);
}
v.push_back(0),t.push_back(0);
sort(v.begin(),v.end());
sort(t.begin(),t.end());
v.push_back(OYY),t.push_back(OYY);
if(m<n){
swap(v,t);
swap(n,m);
}
int l=0,r=1000000007;
int say=0,cev=OYY;
while(l<=r){
int mid=(l+r)/2;
if(c(mid)){
r=mid-1;
}
else l=mid;
cev=min(cev,l);
}
cout<<cev<<endl;
return 0;
}
Compilation message
cipele.cpp: In function 'int32_t main()':
cipele.cpp:42:9: warning: unused variable 'say' [-Wunused-variable]
42 | int say=0,cev=OYY;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1072 ms |
2640 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1047 ms |
2632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Execution timed out |
1065 ms |
468 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1069 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1050 ms |
2384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1037 ms |
2512 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
2368 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |