Submission #1317611

#TimeUsernameProblemLanguageResultExecution timeMemory
1317611Zbyszek99Adriatic (CEOI13_adriatic)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define vi vector<int>
#define vl vector<long long>
#define ff first
#define ss second
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++)
#define forall(it,x) for(auto it: x)
#define pb push_back
#define all(x) x.begin(),x.end()
#define siz(x) (int)x.size();
#define count_bits(x) __builtin_popcount(x)
using namespace std;
const ll MOD = 998244353;

const int n = 2500;
pair<short,short> jump_up[2501][2501];
pair<short,short> jump_down[2501][2501];
pll jump_val_up[2501][2501];
pll jump_val_down[2501][2501];
bool spc[2502][2502];
short min_y[2502][2502];
short min_x[2502][2502];
short max_y[2502][2502];
short max_x[2502][2502];
short pref[2502][2502];
ll ans[2502][2502];

int get_sum(int y1, int y2, int x1, int x2)
{
    if(y1 > y2 || x1 > x2) return 0;
    return pref[y2][x2]-pref[y2][x1-1]-pref[y1-1][x2]+pref[y1-1][x1-1];
}

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int m;
    cin >> m;
    vector<pii> points;
    rep(i,m)
    {
        int x,y;
        cin >> x >> y;
        spc[x][y] = 1;
        points.pb({x,y});
    }
    rep2(i,1,n+1) rep2(j,1,n+1) pref[i][j] = pref[i-1][j]+pref[i][j-1]-pref[i-1][j-1] + (spc[i][j] == 1);
    rep2(i,0,n+1) rep2(j,0,n+1)
    {
        min_y[i][j] = 1e9;
        min_x[i][j] = 1e9;
    }
    rep2(i,1,n) rep2(j,1,n)
    {
        min_y[i][j] = min({min_y[i-1][j],min_y[i][j-1],(spc[i][j] ? i : (int)1e9)});
        min_x[i][j] = min({min_x[i-1][j],min_x[i][j-1],(spc[i][j] ? j : (int)1e9)});
    }
    for(int i = n; i >= 1; i--) for(int j = n; j >= 1; j--)
    {
        max_y[i][j] = max({max_y[i+1][j],max_y[i][j+1],(spc[i][j] ? i : (int)-1)});
        max_x[i][j] = max({max_x[i+1][j],max_x[i][j+1],(spc[i][j] ? j : (int)-1)});
    }
    rep2(i,1,n) rep2(j,1,n)
    {
        // up
        int nxt_y = min(i,min_y[i-1][j-1]);
        int nxt_x = max(j,max_x[i+1][j+1]);
        jump_up[i][j] = {nxt_y,nxt_x};
        // down
        nxt_y = max(i,max_y[i+1][j+1]); 
        nxt_x = min(j,min_x[i-1][j-1]);
        jump_down[i][j] = {nxt_y,nxt_x};
    }
    rep2(i,1,n) for(int j = n; j >= 1; j--)
    {
        pii nxt = jump_up[i][j];
        if(nxt.ff == i && nxt.ss == j)
        {
            jump_val_up[i][j] = {spc[i][j],0};
            continue;
        }
        jump_val_up[i][j] = jump_val_up[nxt.ff][nxt.ss];
        jump_val_up[i][j].ff += jump_val_up[i][j].ss;
        ll new_elms = get_sum(1,i,j,nxt.ss-1)+get_sum(nxt.ff+1,i,nxt.ss,n);
        jump_val_up[i][j].ff += new_elms;
        jump_val_up[i][j].ss += new_elms;
    }
    for(int i = n; i >= 1; i--) rep2(j,1,n)
    {
        pii nxt = jump_down[i][j];
        if(nxt.ff == i && nxt.ss == j)
        {
            jump_val_down[i][j] = {spc[i][j],0};
            continue;
        }
        jump_val_down[i][j] = jump_val_down[nxt.ff][nxt.ss];
        jump_val_down[i][j].ff += jump_val_down[i][j].ss;
        ll new_elms = get_sum(i,n,nxt.ss+1,j)+get_sum(i,nxt.ff-1,1,nxt.ss);
        jump_val_down[i][j].ff += new_elms;
        jump_val_down[i][j].ss += new_elms;
    }
    rep2(i,1,n) rep2(j,1,n) ans[i][j] = jump_val_up[i][j].ff + jump_val_down[i][j].ff-3+m;
    rep(i,m) cout << ans[points[i].ff][points[i].ss] << "\n";
}

Compilation message (stderr)

adriatic.cpp: In function 'int main()':
adriatic.cpp:55:23: warning: overflow in conversion from 'double' to 'short int' changes value from '1.0e+9' to '32767' [-Woverflow]
   55 |         min_y[i][j] = 1e9;
      |                       ^~~
adriatic.cpp:56:23: warning: overflow in conversion from 'double' to 'short int' changes value from '1.0e+9' to '32767' [-Woverflow]
   56 |         min_x[i][j] = 1e9;
      |                       ^~~
adriatic.cpp:60:26: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   60 |         min_y[i][j] = min({min_y[i-1][j],min_y[i][j-1],(spc[i][j] ? i : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from adriatic.cpp:1:
/usr/include/c++/13/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++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
adriatic.cpp:60:26: note:   candidate expects 2 arguments, 1 provided
   60 |         min_y[i][j] = min({min_y[i-1][j],min_y[i][j-1],(spc[i][j] ? i : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/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++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
adriatic.cpp:60:26: note:   candidate expects 3 arguments, 1 provided
   60 |         min_y[i][j] = min({min_y[i-1][j],min_y[i][j-1],(spc[i][j] ? i : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61:
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
adriatic.cpp:60:26: note:   deduced conflicting types for parameter '_Tp' ('short int' and 'int')
   60 |         min_y[i][j] = min({min_y[i-1][j],min_y[i][j-1],(spc[i][j] ? i : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
adriatic.cpp:60:26: note:   deduced conflicting types for parameter '_Tp' ('short int' and 'int')
   60 |         min_y[i][j] = min({min_y[i-1][j],min_y[i][j-1],(spc[i][j] ? i : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adriatic.cpp:61:26: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   61 |         min_x[i][j] = min({min_x[i-1][j],min_x[i][j-1],(spc[i][j] ? j : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/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++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
adriatic.cpp:61:26: note:   candidate expects 2 arguments, 1 provided
   61 |         min_x[i][j] = min({min_x[i-1][j],min_x[i][j-1],(spc[i][j] ? j : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/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++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
adriatic.cpp:61:26: note:   candidate expects 3 arguments, 1 provided
   61 |         min_x[i][j] = min({min_x[i-1][j],min_x[i][j-1],(spc[i][j] ? j : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
adriatic.cpp:61:26: note:   deduced conflicting types for parameter '_Tp' ('short int' and 'int')
   61 |         min_x[i][j] = min({min_x[i-1][j],min_x[i][j-1],(spc[i][j] ? j : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
adriatic.cpp:61:26: note:   deduced conflicting types for parameter '_Tp' ('short int' and 'int')
   61 |         min_x[i][j] = min({min_x[i-1][j],min_x[i][j-1],(spc[i][j] ? j : (int)1e9)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adriatic.cpp:65:26: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   65 |         max_y[i][j] = max({max_y[i+1][j],max_y[i][j+1],(spc[i][j] ? i : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
adriatic.cpp:65:26: note:   candidate expects 2 arguments, 1 provided
   65 |         max_y[i][j] = max({max_y[i+1][j],max_y[i][j+1],(spc[i][j] ? i : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
adriatic.cpp:65:26: note:   candidate expects 3 arguments, 1 provided
   65 |         max_y[i][j] = max({max_y[i+1][j],max_y[i][j+1],(spc[i][j] ? i : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
adriatic.cpp:65:26: note:   deduced conflicting types for parameter '_Tp' ('short int' and 'int')
   65 |         max_y[i][j] = max({max_y[i+1][j],max_y[i][j+1],(spc[i][j] ? i : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
adriatic.cpp:65:26: note:   deduced conflicting types for parameter '_Tp' ('short int' and 'int')
   65 |         max_y[i][j] = max({max_y[i+1][j],max_y[i][j+1],(spc[i][j] ? i : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adriatic.cpp:66:26: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
   66 |         max_x[i][j] = max({max_x[i+1][j],max_x[i][j+1],(spc[i][j] ? j : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
adriatic.cpp:66:26: note:   candidate expects 2 arguments, 1 provided
   66 |         max_x[i][j] = max({max_x[i+1][j],max_x[i][j+1],(spc[i][j] ? j : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
adriatic.cpp:66:26: note:   candidate expects 3 arguments, 1 provided
   66 |         max_x[i][j] = max({max_x[i+1][j],max_x[i][j+1],(spc[i][j] ? j : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
adriatic.cpp:66:26: note:   deduced conflicting types for parameter '_Tp' ('short int' and 'int')
   66 |         max_x[i][j] = max({max_x[i+1][j],max_x[i][j+1],(spc[i][j] ? j : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
adriatic.cpp:66:26: note:   deduced conflicting types for parameter '_Tp' ('short int' and 'int')
   66 |         max_x[i][j] = max({max_x[i+1][j],max_x[i][j+1],(spc[i][j] ? j : (int)-1)});
      |                       ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
adriatic.cpp:71:24: error: no matching function for call to 'min(int&, short int&)'
   71 |         int nxt_y = min(i,min_y[i-1][j-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/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++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
adriatic.cpp:71:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   71 |         int nxt_y = min(i,min_y[i-1][j-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/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++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
adriatic.cpp:71:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   71 |         int nxt_y = min(i,min_y[i-1][j-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
adriatic.cpp:71:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   71 |         int nxt_y = min(i,min_y[i-1][j-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
adriatic.cpp:71:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   71 |         int nxt_y = min(i,min_y[i-1][j-1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
adriatic.cpp:72:24: error: no matching function for call to 'max(int&, short int&)'
   72 |         int nxt_x = max(j,max_x[i+1][j+1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
adriatic.cpp:72:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   72 |         int nxt_x = max(j,max_x[i+1][j+1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
adriatic.cpp:72:24: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   72 |         int nxt_x = max(j,max_x[i+1][j+1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
adriatic.cpp:72:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   72 |         int nxt_x = max(j,max_x[i+1][j+1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
adriatic.cpp:72:24: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   72 |         int nxt_x = max(j,max_x[i+1][j+1]);
      |                     ~~~^~~~~~~~~~~~~~~~~~~
adriatic.cpp:75:20: error: no matching function for call to 'max(int&, short int&)'
   75 |         nxt_y = max(i,max_y[i+1][j+1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
adriatic.cpp:75:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   75 |         nxt_y = max(i,max_y[i+1][j+1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algobase.h:303:5: note:   template argument deduction/substitution failed:
adriatic.cpp:75:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   75 |         nxt_y = max(i,max_y[i+1][j+1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5795 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5795:5: note:   template argument deduction/substitution failed:
adriatic.cpp:75:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   75 |         nxt_y = max(i,max_y[i+1][j+1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5805 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5805:5: note:   template argument deduction/substitution failed:
adriatic.cpp:75:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   75 |         nxt_y = max(i,max_y[i+1][j+1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
adriatic.cpp:76:20: error: no matching function for call to 'min(int&, short int&)'
   76 |         nxt_x = min(j,min_x[i-1][j-1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/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++/13/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
adriatic.cpp:76:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   76 |         nxt_x = min(j,min_x[i-1][j-1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/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++/13/bits/stl_algobase.h:281:5: note:   template argument deduction/substitution failed:
adriatic.cpp:76:20: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'short int')
   76 |         nxt_x = min(j,min_x[i-1][j-1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5775 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5775:5: note:   template argument deduction/substitution failed:
adriatic.cpp:76:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   76 |         nxt_x = min(j,min_x[i-1][j-1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   template argument deduction/substitution failed:
adriatic.cpp:76:20: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   76 |         nxt_x = min(j,min_x[i-1][j-1]);
      |                 ~~~^~~~~~~~~~~~~~~~~~~