Submission #101941

# Submission time Handle Problem Language Result Execution time Memory
101941 2019-03-21T07:05:35 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){
        long long minn=2147483647;
        for(int i=0;i<n;i++)
            for(int j=0;j<m;j++){
                minn=min(abs(b[j]-r[i]),minn);
            }
        ans=ans+minn;
    }
    else{
        long long minn=2147483647;
        for(int i=0;i<m;i++)
            for(int j=0;j<n;j++){
                minn=min(abs(b[i]-r[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:26: error: 'abs' was not declared in this scope
                 minn=min(abs(b[j]-r[i]),minn);
                          ^~~
wiring.cpp:12:26: note: suggested alternative: 'ans'
                 minn=min(abs(b[j]-r[i]),minn);
                          ^~~
                          ans
wiring.cpp:20:26: error: 'abs' was not declared in this scope
                 minn=min(abs(b[i]-r[j]),minn);
                          ^~~
wiring.cpp:20:26: note: suggested alternative: 'ans'
                 minn=min(abs(b[i]-r[j]),minn);
                          ^~~
                          ans