General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
40968288 Practice:
leohan818
727F - 27 GNU C++ Accepted 109 ms 32 KB 2018-07-30 15:16:38 2018-07-30 15:25:32
→ Source
#include<bits/stdc++.h>
using namespace std;
int n, m;
long long u;
long long a[1000], d[1000];
long long minn = -1e17;
int main(){
	int i, j;
	scanf("%d %d", &n, &m);
	memset(d, minn, sizeof(d));
	for (i = 1; i <= n; i++)
		scanf("%lld", &a[i]);
	for (i = n; i >= 0; i--)
		for (j = n; j >= 0; j--) {
			u = (j == 0) ? minn : d[j - 1];
			d[j] = max(min(d[j] + a[i], (long long)0), u);
		}
	while (m--) {
		scanf("%lld", &u);
		printf("%d\n", lower_bound(d, d + n + 1, -u) - d);
	}
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details