Submission #742317

# Submission time Handle Problem Language Result Execution time Memory
742317 2023-05-16T05:54:11 Z viwlesxq Bali Sculptures (APIO15_sculpture) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef string str;

const int N = 101;
const int R = 21;
const int Y = 501;
const ll inf = 1e18;

ll y[N], pref[N];
bool dp[N][R][Y];

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, a, b;
    cin >> n >> a >> b;
    for (int i = 1; i <= n; ++i) {
        cin >> y[i];
        pref[i] = pref[i - 1] + y[i];
    }
    for (int i = 1; i <= n; ++i) {
        dp[i][1][pref[i]] = true; 
    }
    for (int k = 2; k <= b; ++k) {
        for (int i = 1; i <= n; ++i) {
            for (int j = i - 1; j >= 1; --j) {
                for (int x = 0; x < Y; ++x) {
                    if (dp[j][k - 1][x]) {
                        dp[i][k][x | (pref[i] - pref[j])] = true;
                    }
                }
            }
        }
    }
    ll ans = inf;
    for (int k = a; k <= b; ++k) {
        for (int x = 0; x < Y; ++x) {
            if (dp[n][k][x]) {
                ans = min(ans, 1ll * x);
            }
        }
    }
    cout << ans;
}

Compilation message

sculpture.cpp: In function 'int main()':
sculpture.cpp:43:39: error: no matching function for call to 'min(ll&, long long int)'
   43 |                 ans = min(ans, 1ll * x);
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from sculpture.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
sculpture.cpp:43:39: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   43 |                 ans = min(ans, 1ll * x);
      |                                       ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from sculpture.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
sculpture.cpp:43:39: note:   deduced conflicting types for parameter 'const _Tp' ('long int' and 'long long int')
   43 |                 ans = min(ans, 1ll * x);
      |                                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from sculpture.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
sculpture.cpp:43:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   43 |                 ans = min(ans, 1ll * x);
      |                                       ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from sculpture.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
sculpture.cpp:43:39: note:   mismatched types 'std::initializer_list<_Tp>' and 'long int'
   43 |                 ans = min(ans, 1ll * x);
      |                                       ^