Submission #472353

# Submission time Handle Problem Language Result Execution time Memory
472353 2021-09-13T12:08:12 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;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    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 1091 ms 8124 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 8132 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 331 ms 500 KB Output is correct
2 Execution timed out 1092 ms 716 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 37 ms 652 KB Output is correct
2 Execution timed out 1079 ms 716 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 588 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 1087 ms 7628 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 7564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 7232 KB Time limit exceeded
2 Halted 0 ms 0 KB -