# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
170359 |
2019-12-24T21:44:43 Z |
mdn2002 |
Cipele (COCI18_cipele) |
C++14 |
|
1000 ms |
11256 KB |
#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
int n,m,a[100005],b[100005];
bool ck(int x)
{
if(n>=m)
{
int j=0;
for(int i=0;i<n;i++)
{
int aa=max(a[i],b[j]);
int bb=min(a[i],b[j]);
if((n-i)<(m-j))return 0;
cout<<aa<<' '<<bb<<' '<<x<<endl;
if(aa-bb<=x)j++;
if(j==m)break;
}
if(j==m)return 1;
return 0;
}
else
{
int j=0;
for(int i=0;i<m;i++)
{
int aa=max(a[j],b[i]);
int bb=min(a[j],b[i]);
if((n-j)>(m-i))return 0;
if(aa-bb<=x)j++;
if(j==n)break;
}
if(j==n)return 1;
return 0;
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen("lemonade.in","r",stdin);
//freopen("lemonade.out","w",stdout);
cin>>n>>m;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)cin>>b[i];
sort(a,a+n);
sort(b,b+m);
int l=0,r=1e9+20,mid;
while(l<r)
{
mid=(l+r)/2;
if(ck(mid))r=mid;
else l=mid+1;
}
cout<<l;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1065 ms |
10800 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1063 ms |
11240 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
1020 KB |
Output is correct |
2 |
Execution timed out |
1074 ms |
11140 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
54 ms |
1020 KB |
Output is correct |
2 |
Execution timed out |
1070 ms |
10320 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
1016 KB |
Output is correct |
2 |
Execution timed out |
1074 ms |
11256 KB |
Time limit exceeded |