Submission #472343

# Submission time Handle Problem Language Result Execution time Memory
472343 2021-09-13T12:02:13 Z Ahmed_Solyman Cipele (COCI18_cipele) C++14
Compilation error
0 ms 0 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[j]=1;
        ans=max(ans,mn);
    }
    cout<<ans<<endl;
    return 0;
}

Compilation message

cipele.cpp: In function 'int main()':
cipele.cpp:35:13: error: 'j' was not declared in this scope
   35 |         vis[j]=1;
      |             ^