Submission #472344

# Submission time Handle Problem Language Result Execution time Memory
472344 2021-09-13T12:02:38 Z Ahmed_Solyman Cipele (COCI18_cipele) C++14
0 / 90
1000 ms 8132 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);      cout.tie(0);
    ll n,m;cin>>n>>m;
    vector<ll>a,b;
    for(ll i=0;i<n;i++){
        ll k;cin>>k;
        a.push_back(k);
    }
    for(ll i=0;i<m;i++){
        ll k;cin>>k;
        b.push_back(k);
    }
    if(n>m)swap(a,b);
    map<ll,bool>vis;
    ll ans=0;
    for(ll i=0;i<n;i++){
        ll mn=1e18;
        ll idx=0;
        for(ll j=0;j<m;j++){
            if(vis[j])continue;
            ll y=abs(a[i]-b[j]);
            if(y<mn){
                mn=y;
                idx=j;
            }
        }
        vis[idx]=1;
        ans=max(ans,mn);
    }
    cout<<ans<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 8132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 8040 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 289 ms 500 KB Output is correct
2 Execution timed out 1094 ms 588 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 28 ms 676 KB Output is correct
2 Execution timed out 1083 ms 716 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1025 ms 708 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1029 ms 688 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 7592 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 7484 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 7216 KB Time limit exceeded
2 Halted 0 ms 0 KB -