Submission #472338

# Submission time Handle Problem Language Result Execution time Memory
472338 2021-09-13T11:59:44 Z Ahmed_Solyman Cipele (COCI18_cipele) C++14
18 / 90
1000 ms 2632 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(a.size()>b.size())swap(a,b);
    sort(b.begin(),b.end());
    sort(a.begin(),a.end());
    ll ans=0;
    while(a.size() && b.size()){
        ll x=a[0];
        ll mn=1e18;
        a.erase(a.begin());
        ll idx=0;
        for(ll i=0;i<b.size();i++){
            ll y=abs(b[i]-x);
            if(y<mn){
                mn=y;
                idx=i;
            }
        }
        b.erase(b.begin()+idx);
        ans=max(ans,mn);
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

cipele.cpp: In function 'int main()':
cipele.cpp:30:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for(ll i=0;i<b.size();i++){
      |                    ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 2632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 2632 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 332 KB Output is correct
2 Correct 30 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 29 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 428 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 2284 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 2504 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 2264 KB Time limit exceeded
2 Halted 0 ms 0 KB -