Submission #673237

# Submission time Handle Problem Language Result Execution time Memory
673237 2022-12-20T01:45:34 Z Hacv16 Jelly Flavours (IOI20_jelly) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "jelly.h"
using namespace std;
 
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
 
#define fr first
#define sc second

const int MAX = 2005;
const int INF = 0x3f3f3f3f;
 
int find_maximum_unique(int x, int y, vector<int> a, vector<int> b){
	int n = a.size();
	
	vector<pair<int, int>> aux;

	for(int i = 0; i < n; i++)
		aux.emplace_back(a[i], b[i]);

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

	vector<vector<pair<int, int>>> dp(n + 1, vector<pair<int, int>>(y + 1));

	dp[0][0] = {0, x};

	for(int i = 1; i <= y; i++)
        dp[0][t] = {-INF, -INF};

	int ans = 0;

	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= y; j++){
			dp[i][j] = dp[i - 1][j];

			if(dp[i][j].sc >= a[i - 1])
				dp[i][j].fr++, dp[i][j].sc -= a[i - 1];

			if(j >= b[i - 1]){
				pair<int, int> cur = dp[i - 1][j - b[i - 1]]; cur.fr++;
				dp[i][j] = max(dp[i][j], cur);
			}

			ans = max(ans, dp[i][j]);
		}
	}
 
	return ans;
}

Compilation message

jelly.cpp: In function 'int find_maximum_unique(int, int, std::vector<int>, std::vector<int>)':
jelly.cpp:29:15: error: 't' was not declared in this scope
   29 |         dp[0][t] = {-INF, -INF};
      |               ^
jelly.cpp:45:27: error: no matching function for call to 'max(int&, __gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type&)'
   45 |    ans = max(ans, dp[i][j]);
      |                           ^
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 jelly.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
jelly.cpp:45:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'})
   45 |    ans = max(ans, dp[i][j]);
      |                           ^
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 jelly.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
jelly.cpp:45:27: note:   deduced conflicting types for parameter 'const _Tp' ('int' and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'})
   45 |    ans = max(ans, dp[i][j]);
      |                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from jelly.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
jelly.cpp:45:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   45 |    ans = max(ans, dp[i][j]);
      |                           ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from jelly.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
jelly.cpp:45:27: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   45 |    ans = max(ans, dp[i][j]);
      |                           ^