Submission #101935

# Submission time Handle Problem Language Result Execution time Memory
101935 2019-03-21T06:59:14 Z tim25871014 Wiring (IOI17_wiring) C++17
Compilation error
0 ms 0 KB
#include "wiring.h"
using namespace std;

long long min_total_length(vector<int> r, vector<int> b){
    int n=r.size(),m=b.size();

    long long ans=0;
    if(n>m){
        int minn=2147483647;
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++){
                minn=min(abs(b[j]-a[i]),minn);
            }
        ans=ans+minn;
    }
    else{
        int minn=2147483647;
        for(int i=0;i<m;i++)
            for(int j=0;j<n;j++){
                minn=min(abs(b[i]-a[j]),minn);
            }
        ans=ans+minn;
    }
    return ans;
}

Compilation message

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:12:35: error: 'a' was not declared in this scope
                 minn=min(abs(b[j]-a[i]),minn);
                                   ^
wiring.cpp:12:26: error: 'abs' was not declared in this scope
                 minn=min(abs(b[j]-a[i]),minn);
                          ^~~
wiring.cpp:12:26: note: suggested alternative: 'ans'
                 minn=min(abs(b[j]-a[i]),minn);
                          ^~~
                          ans
wiring.cpp:20:35: error: 'a' was not declared in this scope
                 minn=min(abs(b[i]-a[j]),minn);
                                   ^
wiring.cpp:20:26: error: 'abs' was not declared in this scope
                 minn=min(abs(b[i]-a[j]),minn);
                          ^~~
wiring.cpp:20:26: note: suggested alternative: 'ans'
                 minn=min(abs(b[i]-a[j]),minn);
                          ^~~
                          ans