?
# | Author | Problem | Lang | Verdict | Time | Memory | Sent | Judged | |
---|---|---|---|---|---|---|---|---|---|
244509236 |
Practice: luogu_bot5 |
727F - 27 | C++17 (GCC 9-64) | Accepted | 1122 ms | 4496 KB | 2024-02-02 10:25:46 | 2024-02-02 10:25:46 |
// LUOGU_RID: 145782247 #include<bits/stdc++.h> using namespace std; #define int long long int n,m,a[757],f[757][757],x; signed main() { memset(f,0x3f,sizeof(f)); cin>>n>>m; for(int i=1;i<=n+1;i++) f[i][0]=0; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=n;i>=1;i--) for(int j=1;j<=n-i+1;j++) f[i][j]=min(f[i+1][j],max((int)0,f[i+1][j-1]-a[i])); for(int i=1;i<=m;i++) { cin>>x; for(int j=n;j>=0;j--) if(f[1][j]<=x) { cout<<n-j<<"\n"; break; } } return 0; }
?
?
?
?