Language: C++

#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int n;
ll ans[16];
int cur[16];
int x[16],y[16],p[16];
int minx[40000][16],miny[40000][16];

void dfs(int m,int rx,int ry,int kisuu){
  if(m==n){
    set<ll> memox,memoy;
    for(int i=0;i<n;i++){
      if(cur[i]==1) memox.insert(x[i]);
      else if(cur[i]==-1) memoy.insert(y[i]);
    } 
    int sum=(int)memox.size()+(int)memoy.size();
    ll temp=0;
    for(int i=0;i<n;i++){
      temp+=1ll*p[i]*min(minx[rx][i],miny[ry][i]);
    }
    ans[sum]=min(ans[sum],temp);
  }
  else{
    cur[m]=1;
    dfs(m+1,rx+kisuu,ry,2*kisuu);
    cur[m]=0;
    dfs(m+1,rx,ry,2*kisuu);
    cur[m]=-1;
    dfs(m+1,rx,ry+kisuu,2*kisuu);
  }
  return;
}

int main() {
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>x[i]>>y[i]>>p[i];
  }
  for(int i=0;i<n+1;i++){
    ans[i]=1e18;
  }
  for(int i=0;i<(1<<n);i++){
    bool ch[n];
    for(int j=0;j<n;j++){
      ch[j]=false;
    }
    for(int j=0;j<n;j++){
      if((i>>j)&1) ch[j]=true;
    }
    for(int j=0;j<n;j++){
      if(ch[j]){
        minx[i][j]=0;
        miny[i][j]=0;
      }
      else{
        ll tempx=min(abs(x[j]),abs(y[j]));
        ll tempy=tempx;
        for(int k=0;k<n;k++){
          if(ch[k]){
            tempx=min(tempx,abs(x[j]-x[k]));
            tempy=min(tempy,abs(y[j]-y[k]));
          } 
        }
        minx[i][j]=tempx;
        miny[i][j]=tempy;
      }
    }
  }
  dfs(0,0,0,1);
  for(int i=0;i<=n;i++){
    if(ans[i]==1e18) cout<<0<<endl;
    else cout<<ans[i]<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:81:22: error: no matching function for call to 'min(ll&, int)'
   81 |             tempx=min(tempx,abs(x[j]-x[k]));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:81:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   81 |             tempx=min(tempx,abs(x[j]-x[k]));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:81:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   81 |             tempx=min(tempx,abs(x[j]-x[k]));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~
a.cc:82:22: error: no matching function for call to 'min(ll&, int)'
   82 |             tempy=min(tempy,abs(y[j]-y[k]));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:82:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   82 |             tempy=min(tempy,abs(y[j]-y[k]));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:82:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   82 |             tempy=min(tempy,abs(y[j]-y[k]));
      |                   ~~~^~~~~~~~~~~~~~~~~~~~~~