Submission #472347

# Submission time Handle Problem Language Result Execution time Memory
472347 2021-09-13T12:04:38 Z Ahmed_Solyman Cipele (COCI18_cipele) C++14
0 / 90
1000 ms 8184 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<min(n,m);i++){
        ll mn=1e18;
        ll idx=0;
        for(ll j=0;j<max(n,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 1085 ms 8184 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 8124 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 302 ms 516 KB Output is correct
2 Execution timed out 1090 ms 716 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 30 ms 588 KB Output is correct
2 Execution timed out 1098 ms 588 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1020 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1051 ms 708 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1071 ms 588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 7628 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 7460 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 7152 KB Time limit exceeded
2 Halted 0 ms 0 KB -