# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
472379 |
2021-09-13T12:39:47 Z |
AbdoMo |
Cipele (COCI18_cipele) |
C++17 |
|
1000 ms |
5264 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;
void solve(){
int n,m;
cin>>n>>m;
vector<int>v1,v2;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
v1.pb(x);
}
for(int i=0;i<m;i++)
{
int x;
cin>>x;
v2.pb(x);
}
int arr[n+m],arr2[n+m];
if(n>m)
{
for(int i=0;i<n;i++)
{
arr2[i]=v1[i];
}
for(int i=0;i<m;i++)
{
arr[i]=v2[i];
}
swap(n,m);
}
else
{
for(int i=0;i<n;i++)
{
arr[i]=v1[i];
}
for(int i=0;i<m;i++)
{
arr2[i]=v2[i];
}
}
sort(arr,arr+n);
sort(arr2,arr2+m);
vector<pair<int,int>>dif;
for(int i=0;i<m;i++)
{
dif.pb({0,i});
for(int j=0;j<n;j++)
{
dif[i].first=max(dif[i].first,abs(arr[j]-arr2[i]));
}
}
bool vis[n+m+100]={};
sort(dif.rbegin(),dif.rend());
for(int i=0;i<abs(n-m);i++)
{
vis[dif[i].second]=1;
}
/*for(int i=0;i<m;i++)
{
//cout<<dif[i].first<<" "<<dif[i].second<<endl;
cout<<vis[i]<<" ";
}*/
int ans=0;
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(vis[j])continue;
ans=max(ans,abs(arr[i]-arr2[j]));
vis[j]=1;
break;
}
}
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 |
1096 ms |
5264 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1093 ms |
5140 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
460 KB |
Output is correct |
2 |
Correct |
43 ms |
668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
588 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
31 ms |
712 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
720 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
40 ms |
652 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1092 ms |
4512 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
5056 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
4488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |