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 ll long long
#define some_one https://codeforces.com/problemset/problem/1575/J
using namespace std;
const ll N=1e6+9,M=2e18+9,L=18,mod=1e9+7;
ll a[N],n,k,x,y,z;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n>>k;
for(ll i=0;i<n;++i)
cin>>a[i];
for(ll i=1;i<n;++i)cin>>x>>y;
x=0,y=0;
for(ll i=0;i<n;++i)
{
y+=a[i];
if(y>k)y=a[i],++x;
}
cout<<x;
}
//hocln and wesam hate cp
//and another thing!
//jeowesam+some_one=Love
//Nice,yep?
# | 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... |