This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define itn int
#define INF 100000000
#define MOD 998244353
#define MAX 100003
#define endl "\n"
#define ff first
#define ss second
using namespace std;
int temp;
vector <int> v(MAX + 2), p(MAX + 2);
signed main() {
GOOD_LUCK
int t;
t = 1;
// cin >> t;
while (t--) {
int n, k;
cin >> n >> k;
for (int i=0; i < n; i++) {
cin >> v[i];
if (i == 0) p[i] = v[i];
else p[i] = p[i-1] + v[i];
}
int cnt=0, j=0;
for (int i=0; i < n-1; i++) {
if (p[i+1] - j > k) {
j = p[i];
cnt++;
}
}
cout << cnt;
}
return 0;
}
// Problem A
// by Ekber_Ekber
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |