Submission #41415

# Submission time Handle Problem Language Result Execution time Memory
41415 2018-02-17T07:51:00 Z cmaster Bali Sculptures (APIO15_sculpture) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>*/
 
#define pb push_back
#define mp make_pair
#define sz(s) ((int)(s.size()))
#define all(s) s.begin(), s.end()
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define per(i, n, a) for (int i = n; i >= a; --i)
#define onlycin ios_base::sync_with_stdio(false); cin.tie(0) 
#define F first
#define S second
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
/*typedef tree<
pair < int, int >,
null_type,
less< pair < int, int > >,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
// find_by_order() order_of_key()
const int MAXN = (int)5e5+228;
const char nxtl = '\n';
const int mod = (int)1e9+7;
const double eps = (double)1e-7;
template<typename T> inline bool updmin(T &a, const T &b) {return a > b ? a = b, 1 : 0;}
template<typename T> inline bool updmax(T &a, const T &b) {return a < b ? a = b, 1 : 0;}

int n, a[MAXN], l, r;
map < pair < ll, pair < ll, ll > >, ll > dp;

int rec(int i, ll cost, int cnt) {
	if(i == n+1) {
		if(l <= cnt && cnt <= r) return cost;
		return mod;
	}
	if(dp.count(mp(i, mp(cost, cnt)))) return dp[mp(i, mp(cost, cnt))];
	ll ans = (ll)1e15;
	ll sum = 0;
	rep(j, i, n) {
		sum += a[j];
		ans = min(ans, rec(j+1, cost | sum, cnt+1));
	}
	return dp[mp(i, mp(cost, cnt))] = ans;
}

int main() {
	#ifdef accepted
		freopen(".in", "r", stdin);
		freopen(".out", "w", stdout);
	#endif
	onlycin;
	cin >> n >> l >> r;
	rep(i, 1, n) cin >> a[i];
	cout << rec(1, 0, 0) << nxtl;
	
	return 0;
}

Compilation message

sculpture.cpp: In function 'int rec(int, ll, int)':
sculpture.cpp:47:45: error: no matching function for call to 'min(ll&, int)'
   ans = min(ans, rec(j+1, cost | sum, cnt+1));
                                             ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from sculpture.cpp:1:
/usr/include/c++/5/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++/5/bits/stl_algobase.h:195:5: note:   template argument deduction/substitution failed:
sculpture.cpp:47:45: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   ans = min(ans, rec(j+1, cost | sum, cnt+1));
                                             ^
In file included from /usr/include/c++/5/bits/char_traits.h:39:0,
                 from /usr/include/c++/5/ios:40,
                 from /usr/include/c++/5/istream:38,
                 from /usr/include/c++/5/sstream:38,
                 from /usr/include/c++/5/complex:45,
                 from /usr/include/c++/5/ccomplex:38,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:52,
                 from sculpture.cpp:1:
/usr/include/c++/5/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++/5/bits/stl_algobase.h:243:5: note:   template argument deduction/substitution failed:
sculpture.cpp:47:45: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   ans = min(ans, rec(j+1, cost | sum, cnt+1));
                                             ^
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from sculpture.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3445:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
     min(initializer_list<_Tp> __l)
     ^
/usr/include/c++/5/bits/stl_algo.h:3445:5: note:   template argument deduction/substitution failed:
sculpture.cpp:47:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   ans = min(ans, rec(j+1, cost | sum, cnt+1));
                                             ^
In file included from /usr/include/c++/5/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/5/bits/stdc++.h:64,
                 from sculpture.cpp:1:
/usr/include/c++/5/bits/stl_algo.h:3451: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++/5/bits/stl_algo.h:3451:5: note:   template argument deduction/substitution failed:
sculpture.cpp:47:45: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   ans = min(ans, rec(j+1, cost | sum, cnt+1));
                                             ^