Submission #295859

#TimeUsernameProblemLanguageResultExecution timeMemory
295859Muhammetali전선 연결 (IOI17_wiring)C++11
Compilation error
0 ms0 KiB
#include "wiring.h"
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
ll min_total_length(std::vector<int> r, std::vector<int> b)
{
	ll res=0;
	for (int i=0;i<sz(r);i++)
	{
		ll mn=INT_MAX;
		for (int j=0;j<sz(b);j++)
		{
			mn=min(mn,abs(r[i]-b[j]));
		}
		res+=mn;
	}
	return res;
}

Compilation message (stderr)

wiring.cpp: In function 'll min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:34:28: error: no matching function for call to 'min(ll&, int)'
   34 |    mn=min(mn,abs(r[i]-b[j]));
      |                            ^
In file included from /usr/include/c++/9/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:198:5: note: candidate: 'template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)'
  198 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:198:5: note:   template argument deduction/substitution failed:
wiring.cpp:34:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |    mn=min(mn,abs(r[i]-b[j]));
      |                            ^
In file included from /usr/include/c++/9/vector:60,
                 from wiring.h:1,
                 from wiring.cpp:1:
/usr/include/c++/9/bits/stl_algobase.h:246:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  246 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algobase.h:246:5: note:   template argument deduction/substitution failed:
wiring.cpp:34:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |    mn=min(mn,abs(r[i]-b[j]));
      |                            ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from wiring.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3444:5: note: candidate: 'template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)'
 3444 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3444:5: note:   template argument deduction/substitution failed:
wiring.cpp:34:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |    mn=min(mn,abs(r[i]-b[j]));
      |                            ^
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from wiring.cpp:2:
/usr/include/c++/9/bits/stl_algo.h:3450:5: note: candidate: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3450 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/9/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
wiring.cpp:34:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |    mn=min(mn,abs(r[i]-b[j]));
      |                            ^