General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
87819972 Practice:
vjudge3
727F - 27 GNU C++11 Accepted 156 ms 8520 KB 2020-07-24 05:22:54 2020-07-24 05:22:54
→ Source
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m;
ll a[755],f[755][755];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	memset(f,0x3f,sizeof(f));
	f[n+1][0]=0LL;
	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(f[i+1][j-1]-a[i],0LL));
		f[i][0]=0LL;
	}
	while(m--){
		ll x;
		scanf("%lld",&x);
		for(int i=n;i>=0;i--)
			if(f[1][i]<=x){
				printf("%d\n",n-i);
				break;
			}
	}
	return 0;
} 
 	 	  			 	   					 				 		  		
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details