# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472214 |
2021-09-13T09:30:53 Z |
AbdoMo |
Cipele (COCI18_cipele) |
C++17 |
|
1000 ms |
2056 KB |
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define pb push_back
const int mod = 1e9+7;
using namespace std;
bool comp(pair<int,int>&a ,pair<int,int>&b)
{
if(a.first==b.first)
{
return a.second>b.second;
}
return a.first<b.first;
}
void solve()
{
int n,m;
cin>>n>>m;
int arr[100000],arr2[100000];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
for(int i=0;i<m;i++)
{
cin>>arr2[i];
}
int ans=0;
if(n<m)
{
bool vis[100000]={};
for(int i=0;i<n;i++)
{
int t=1e13;
int ind=0;
for(int j=0;j<m;j++)
{
if(vis[j])continue;
if(abs(arr[i]-arr2[j])<t)
{
t=abs(arr[i]-arr2[j]);
ind = j;
}
}
vis[ind]=1;
ans=max(ans,t);
}
}
else if(n>m)
{
bool vis[100000]={};
for(int i=0;i<m;i++)
{
int t=1e13;
int ind=0;
for(int j=0;j<n;j++)
{
if(vis[j])continue;
if(abs(arr2[i]-arr[j])<t)
{
t=abs(arr2[i]-arr[j]);
ind = j;
}
}
vis[ind]=1;
ans=max(ans,t);
}
}
else
{
int tans=0;
bool vis1[100000]={};
for(int i=0;i<n;i++)
{
int t=1e13;
int ind=0;
for(int j=0;j<m;j++)
{
if(vis1[j])continue;
if(abs(arr[i]-arr2[j])<t)
{
t=abs(arr[i]-arr2[j]);
ind = j;
}
}
vis1[ind]=1;
tans=max(tans,t);
}
bool vis[100000]={};
for(int i=0;i<m;i++)
{
int t=1e13;
int ind=0;
for(int j=0;j<n;j++)
{
if(vis[j])continue;
if(abs(arr2[i]-arr[j])<t)
{
t=abs(arr2[i]-arr[j]);
ind = j;
}
}
vis[ind]=1;
ans=max(ans,t);
}
ans=min(ans,tans);
}
cout<<ans<<endl;
}
int32_t main(){
int t=1;
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
//cin>>t;
while(t--){solve();}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
1996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
1996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1996 KB |
Output is correct |
2 |
Incorrect |
73 ms |
2048 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1996 KB |
Output is correct |
2 |
Incorrect |
79 ms |
2056 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
54 ms |
2052 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
1996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
68 ms |
1996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
1996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1067 ms |
1996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1087 ms |
1996 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |