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>
using namespace std;
# define int long long
void solve()
{
int n, k, ans = 0, sum = 0;
cin >> n >> k;
vector < int > a(n);
for(int i = 0; i < n; i++)
cin >> a[i];
for(int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
}
for(int i = 0; i < n; i++)
{
if(sum + a[i] > k)
{
sum = a[i];
ans++;
}
else sum += a[i];
}
cout << ans << endl;
}
signed main()
{
int tt = 1;
// cin >> tt;
while(tt--)
solve();
}
# | 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... |