QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#271052 | #5303. No Bug No Game | arahato | WA | 36ms | 3632kb | C++14 | 599b | 2023-12-01 21:41:36 | 2023-12-01 21:41:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=3005;
int f[N][2],g[N][2],n,m,a[15],p;
signed main(){
ios::sync_with_stdio(0);
cin>>n>>m;
memset(f,-60,sizeof f);
memset(g,-60,sizeof g);
f[0][0]=0;
for(int i=1;i<=n;i++){
cin>>p;
for(int i=1;i<=p;i++) cin>>a[i];
for(int i=1;i<=m;i++){
if(i>=p) for(int o:{0,1}) g[i][o]=max(g[i][o],f[i-p][o]+a[p]);
for(int j=1;j<=p;j++) if(i>=j){
g[i][1]=max(g[i][1],f[i-j][0]+a[j]);
}
}
memcpy(f,g,sizeof f);
}
int ans=0;
for(int i=0;i<=m;i++) for(int o:{0,1}) ans=max(ans,f[i][o]);
cout<<ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3452kb
input:
4 5 2 1 3 2 1 1 2 3 1 2 1 3
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: -100
Wrong Answer
time: 36ms
memory: 3632kb
input:
3000 3000 10 70562 30723 79371 82224 63977 3362 26909 96449 48163 66159 4 18007 33590 80674 91139 4 10304 31694 70745 50656 10 63090 17226 13187 73881 38137 15237 55750 82751 75854 39658 8 95640 66120 87735 36388 44046 92415 6952 94772 9 60565 27904 98726 87052 35768 25453 14563 34273 92501 10 66332...
output:
68250371
result:
wrong answer 1st numbers differ - expected: '68279788', found: '68250371'