General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
40910610 Practice:
Enderturtle
727F - 27 GNU C++ Accepted 592 ms 32 KB 2018-07-29 11:36:38 2018-07-29 11:36:38
→ Source
#include<bits/stdc++.h>
#define ll long long
#define rep(i,a,b) for(int i=a;i<=b;++i)
#define repp(i,a,b) for(int i=a;i>=b;--i)
using namespace std;
int n,m;ll u;
ll a[1000]; 
ll d[1000];
ll minn=-1e17;

int main(){
	scanf("%d%d",&n,&m);
	rep(i,1,n){
		scanf("%lld",&a[i]);
		d[i]=minn;
	}
	repp(i,n,0){
		repp(j,n,0){
			if(j==0){
				u=minn;
			}else u=d[j-1];
			d[j]=max(min(d[j]+a[i],0LL),u);
		}
	}
	while(m--){
		scanf("%lld",&u);
		int k=lower_bound(d,d+n+1,-u)-d;
		cout<<k<<endl;
	}
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details