QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#729478 | #5303. No Bug No Game | Fluoresce | Compile Error | / | / | C++20 | 1.9kb | 2024-11-09 17:12:17 | 2024-11-09 17:12:19 |
Judging History
answer
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define debug(a) cout<<a<<'\n'
#define Pll pair<ll,ll>
#define PII pair<int,int>
#define ft first
#define sd second
#define vec vector
#define pushk push_back
#define ump unordered_map
#define pl p<<1
#define pr p<<1|1
using namespace std;
const int N = 3e3 + 10, M = 2e6 + 10, mod = 1e9+7;
const ll inf = 1e18;
const ld eps = 1e-13;
int mov[4][2] = { {0,1},{1,0},{-1,0},{0,-1} }, dx, dy, _ = 1, __ = 1;
void bout(bool f) {
if (f)cout << "YES\n";
else cout << "NO\n";
}
ll n,m,k;
int pre[N][N],suf[N][N],np[N][15];
void ini() {
}
void solve() {
cin>>n>>k;
int x,y,z,w,v,p,sp=0;
for(int i=1;i<=n;++i){
cin>>np[i][0];
sp+=np[i][0];
for(int j=1;j<=np[i][0];++j)cin>>np[i][j];
}
memset(pre,0xcf,sizeof pre);
memset(suf,0xcf,sizeof suf);
pre[0][0]=suf[n+1][0]=0;
for(int i=1;i<=n;++i){
p=np[i][0];
w=np[i][p];
for(int j=0;j<=k;++j){
if(j>=p)pre[i][j]=max(pre[i-1][j],pre[i-1][j-p]+w);
else pre[i][j]=pre[i-1][j];
}
}
for(int i=n;i>=1;--i){
p=np[i][0];
w=np[i][p];
for(int j=0;j<=k;++j){
if(j>=p)suf[i][j]=max(suf[i+1][j],suf[i+1][j-p]+w);
else suf[i][j]=suf[i+1][j];
}
}
int ans=0;
ans=pre[n][min(sp,k)];
for(int i=1;i<=n;++i){
p=np[i][0];
for(int V=max(k-p+1,0ll);V<k;++V){
w=np[i][k-V];
for(int j=0;j<=V;++j){
ans=max(ans,pre[i-1][j]+suf[i+1][V-j]+w);
}
}
}
cout<<ans;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifndef ONLINE_JUDGE
streambuf *cinbp=cin.rdbuf(),*coutbp=cout.rdbuf();
ifstream fin("in.txt");
ofstream fout("out.txt");
cin.rdbuf(fin.rdbuf());
cout.rdbuf(fout.rdbuf());
#endif
//cin >> _;
__ = _;
ini();
while (_--) {
solve();
}
return 0;
}
Details
answer.code: In function ‘void solve()’: answer.code:60:23: error: no matching function for call to ‘min(int&, ll&)’ 60 | ans=pre[n][min(sp,k)]; | ~~~^~~~~~ In file included from /usr/include/c++/13/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code: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: answer.code:60:23: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘ll’ {aka ‘long long int’}) 60 | ans=pre[n][min(sp,k)]; | ~~~^~~~~~ /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: answer.code:60:23: note: deduced conflicting types for parameter ‘const _Tp’ (‘int’ and ‘ll’ {aka ‘long long int’}) 60 | ans=pre[n][min(sp,k)]; | ~~~^~~~~~ 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: answer.code:60:23: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 60 | ans=pre[n][min(sp,k)]; | ~~~^~~~~~ /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: answer.code:60:23: note: mismatched types ‘std::initializer_list<_Tp>’ and ‘int’ 60 | ans=pre[n][min(sp,k)]; | ~~~^~~~~~