QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394209 | #2536. Akcija | OccDreamer | Compile Error | / | / | C++14 | 2.5kb | 2024-04-20 10:19:49 | 2024-04-20 10:19:50 |
Judging History
This is the latest submission verdict.
- [2024-04-20 10:19:50]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-04-20 10:19:49]
- Submitted
answer
//OccDreamer
#include<bits/stdc++.h>
#define vc vector
#define db double
#define fi first
#define se second
#define ll long long
#define mk make_pair
#define pb push_back
#define RI register int
#define PI pair<int,int>
#define ull unsigned long long
#define err cerr << " -_- " << endl
#define debug cerr << " ------------------- " << endl
#define input(x) freopen(#x".in","r",stdin)
#define output(x) freopen(#x".out","w",stdout)
#define NO puts("No")
#define YES puts("Yes")
//#define OccDreamer
#define int long long
using namespace std;
namespace IO{
inline int read(){
int X=0, W=0; char ch=getchar();
while(!isdigit(ch)) W|=ch=='-', ch=getchar();
while(isdigit(ch)) X=(X<<1)+(X<<3)+(ch^48), ch=getchar();
return W?-X:X;
}
inline void write(ll x){
if(x<0) x=-x, putchar('-');
if(x>9) write(x/10);
putchar(x%10+'0');
}
inline void sprint(ll x){write(x), putchar(32);}
inline void eprint(ll x){write(x), putchar(10);}
}using namespace IO;
const int MAXN = 2005;
int n, k, pos;
struct P{
int w, d;
inline bool friend operator < (const P &x, const P &y){return x.d==y.d?x.w<y.w:x.d<y.d;}
}c[MAXN];
struct dp{
int num; ll val;
inline dp friend operator + (const dp &x, const dp &y){return dp{x.num+y.num,x.val+y.val};}
inline bool friend operator < (const dp &x, const dp &y){
return x.num==y.num?x.val<y.val:x.num>y.num;
}
}f[MAXN][MAXN];
inline bool comp(dp x, dp y){
return (x+f[pos+1][x.num])<(y+f[pos+1][y.num]);
}
signed main(){
n=read(), k=read();
for(int i=1;i<=n;++i) c[i].w=read(), c[i].d=read();
sort(c+1,c+1+n);
for(int i=n;i>=1;--i){
for(int j=n;j>=0;--j){
f[i][j]=min(f[i][j],f[i+1][j]); f[i][j]=min(f[i][j+1]);
if(c[i].d>j) f[i][j]=min(f[i][j],f[i+1][j+1]+dp{1,c[i].w});
//cerr << "dp:" << i << ' ' << j << ' ' << f[i][j].num << ' ' << f[i][j].val << endl;
}
}
cout << f[0][0].num << ' ' << f[0][0].val << endl;
return 0;
vc<dp> now; now.pb(dp{0,0});
for(int i=1;i<=n;++i){
vc<dp> S;
//cerr << i << ' ' << now[0].num << ' ' << now[0].val << endl;
for(auto j:now){
S.pb(j);
if(c[i].d>j.num) S.pb(dp{j.num+1,j.val+c[i].w});
}
pos=i+1;
sort(S.begin(),S.end(),comp);
int o=min((long long)(S.size()),k); now.clear();
for(int j=0;j<o;++j) now.pb(S[j]);
}
sort(now.begin(),now.end());
for(auto i:now) sprint(i.num), eprint(i.val);
return 0;
}
/*
9 1
539032129 4
539032129 4
539032130 4
539031219 4
539019129 4
539032129 4
539034123 4
539042939 4
539524354 4
*/
Details
answer.code: In function ‘int main()’: answer.code:71:68: error: no matching function for call to ‘min(dp&)’ 71 | f[i][j]=min(f[i][j],f[i+1][j]); f[i][j]=min(f[i][j+1]); | ~~~^~~~~~~~~~~ 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:2: /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:71:68: note: candidate expects 2 arguments, 1 provided 71 | f[i][j]=min(f[i][j],f[i+1][j]); f[i][j]=min(f[i][j+1]); | ~~~^~~~~~~~~~~ /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:71:68: note: candidate expects 3 arguments, 1 provided 71 | f[i][j]=min(f[i][j],f[i+1][j]); f[i][j]=min(f[i][j+1]); | ~~~^~~~~~~~~~~ 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:71:68: note: ‘dp’ is not derived from ‘std::initializer_list<_Tp>’ 71 | f[i][j]=min(f[i][j],f[i+1][j]); f[i][j]=min(f[i][j+1]); | ~~~^~~~~~~~~~~ /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:71:68: note: ‘dp’ is not derived from ‘std::initializer_list<_Tp>’ 71 | f[i][j]=min(f[i][j],f[i+1][j]); f[i][j]=min(f[i][j+1]); | ~~~^~~~~~~~~~~