Submission #225222

# Submission time Handle Problem Language Result Execution time Memory
225222 2020-04-19T15:45:04 Z Vimmer Mobitel (COCI19_mobitel) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

//#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("-O3")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("no-stack-protector")

#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 200005
#define MOD ll(1e9 + 7)

using namespace std;

typedef long long ll;


int dp[2][301][2005];

ll a[301][301];

vector <ll> vr;

int opr(int x) {if (vr[sz(vr) - 2] <= x) return sz(vr) - 2; return upper_bound(vr.begin(), vr.end(), x) - vr.begin() - 1;}

int main()
{

    ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n, m, k;

    cin >> n >> m >> k;

    vr.pb(k);

    for (int i = 1; i <= k; i++)
    {
        ll val = vr.back();

        while ((val - 1) * i >= k) val--;

        if (vr.back() != val) vr.pb(val);
    }

    vr.pb(1e18);

    sort(vr.begin(), vr.end());

    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) cin >> a[i][j];

   dp[0][0][opr(min(k, a[0][0]))] = 1;

    for (register int i = 0; i < n; i++)
        {
            for (register int j = 0; j < m; j++)
              for (register int u = 0; u < sz(vr) - 1; u++)
                {
                    if (dp[0][j][u] == 0) continue;

                    ll val = vr[u];

                    if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;

                    if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                }

            if (i + 1 != n)
            {
                for (register int j = 0; j < m; j++)
                  for (register int u = 0; u < sz(vr) - 1; u++) {dp[0][j][u] = dp[1][j][u]; dp[1][j][u] = 0;}
            }
        }

    cout << dp[0][m - 1][sz(vr) - 2];
}

Compilation message

mobitel.cpp: In function 'int main()':
mobitel.cpp:56:31: error: no matching function for call to 'min(int&, ll&)'
    dp[0][0][opr(min(k, a[0][0]))] = 1;
                               ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
mobitel.cpp:56:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
    dp[0][0][opr(min(k, a[0][0]))] = 1;
                               ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
mobitel.cpp:56:31: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
    dp[0][0][opr(min(k, a[0][0]))] = 1;
                               ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
mobitel.cpp:56:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    dp[0][0][opr(min(k, a[0][0]))] = 1;
                               ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
mobitel.cpp:56:31: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
    dp[0][0][opr(min(k, a[0][0]))] = 1;
                               ^
mobitel.cpp:67:74: error: no matching function for call to 'min(int&, ll)'
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                          ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
mobitel.cpp:67:74: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                          ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
mobitel.cpp:67:74: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                          ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
mobitel.cpp:67:74: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                          ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
mobitel.cpp:67:74: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                          ^
mobitel.cpp:67:118: error: no matching function for call to 'min(int&, ll)'
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                                                                      ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
mobitel.cpp:67:118: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                                                                      ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
mobitel.cpp:67:118: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                                                                      ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
mobitel.cpp:67:118: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                                                                      ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
mobitel.cpp:67:118: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                     if (i + 1 != n) dp[1][j][opr(min(k, val * a[i + 1][j]))] = (dp[1][j][opr(min(k, val * a[i + 1][j]))] + dp[0][j][u]) % MOD;
                                                                                                                      ^
mobitel.cpp:69:78: error: no matching function for call to 'min(int&, ll)'
                     if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                                                                              ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
mobitel.cpp:69:78: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
                     if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                                                                              ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
mobitel.cpp:69:78: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
                     if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                                                                              ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
mobitel.cpp:69:78: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                     if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                                                                              ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   template argument deduction/substitution failed:
mobitel.cpp:69:78: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
                     if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                                                                              ^
mobitel.cpp:69:126: error: no matching function for call to 'min(int&, ll)'
                     if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                                                                                                                              ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
mobitel.cpp:69:126: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
                     if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                                                                                                                              ^
In file included from /usr/include/c++/7/bits/char_traits.h:39:0,
                 from /usr/include/c++/7/ios:40,
                 from /usr/include/c++/7/istream:38,
                 from /usr/include/c++/7/sstream:38,
                 from /usr/include/c++/7/complex:45,
                 from /usr/include/c++/7/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
mobitel.cpp:69:126: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll {aka long long int}')
                     if (j + 1 != m) dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] = (dp[0][j + 1][opr(min(k, val * a[i][j + 1]))] + dp[0][j][u]) % MOD;
                                                                                                                              ^
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from mobitel.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note:   template argument deduction/substitution failed:
mobitel.cpp:69:126: note:   mismatched types '