Language: C++

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
/* 4 方向への隣接頂点への移動を表すベクトル */
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
int main(){
ll N; cin>>N;
ll field[N][N]={};
vector<vector<ll> > dist(N, vector<ll>(N, -1)); 
for(ll i=0; i<N;i++){
for(ll j=0; j<N;j++){
field[i][j]=1;
dist[i][j]=min(i,j,N-1-i,N-1-j);}}
ll p,a,b;
ll counter=0;
ll ca=0;
ll cb=100000;
for(ll i=0; i<N*N;i++){
cin>>p; p--;
a=p/N; 
b=p%N;
field[a][b]=0;
cb=100000;
ca+=dist[a][b];
    deque<pair<ll,ll> > que; 
    que.push_front(make_pair(a, b)); 
  
    while (!que.empty()) {
        pair<ll, ll> current_pos = que.front(); // キューの先頭を見る (C++ ではこれをしても pop しない)
        ll x = current_pos.first;
        ll y = current_pos.second;
        que.pop_front(); // キューから pop を忘れずに
        if(field[x][y]==1){
        for (ll direction = 0; direction < 4; ++direction) {
            ll next_x = x + dx[direction];
            ll next_y = y + dy[direction];
         
            if(dist[next_x][next_y]>dist[x][y]+1){
              dist[next_x][next_y]=dist[x][y]+1;
              que.push_front(make_pair(next_x, next_y));}}}
          
        if(field[x][y]==0){
        for (ll direction = 0; direction < 4; ++direction) {
            ll next_x = x + dx[direction];
            ll next_y = y + dy[direction];
         
            if(dist[next_x][next_y]>dist[x][y]){
              dist[next_x][next_y]=dist[x][y];
              que.push_front(make_pair(next_x, next_y));}}}
    }}
   cout << counter << endl;}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:15: error: no matching function for call to 'min(ll&, ll&, ll, ll)'
   16 | dist[i][j]=min(i,j,N-1-i,N-1-j);}}
      |            ~~~^~~~~~~~~~~~~~~~~
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:   candidate expects 2 arguments, 4 provided
/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, 4 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, 4 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:   candidate expects 2 arguments, 4 provided