제출 #1293992

#제출 시각아이디문제언어결과실행 시간메모리
1293992ako_aqsinPaprike (COI18_paprike)C++20
0 / 100
23 ms6616 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define f first
#define s second
#define pb push_back
#define yes cout << "yes" << endl;
#define YES cout << "YES" << endl;
#define no cout << "no" << endl;
#define NO cout << "NO" << endl;
void never_give_up() {
    int n, k;
    cin >> n >> k;
    vector<int>vt(n + 1);
    vector<vector<int>>arr(n + 1);
    for(int i = 1; i <= n; i++){
        cin >> vt[i];
    }
    for(int i = 1; i < n; i++){
       int a, b;
       cin >> a >> b;
       arr[i].pb(a);
       arr[i].pb(b);
    }
    int sum = 0, to = 0;;
    for(int i = 1; i <= n; i++){
        if(vt[i] + to > k){
            to += vt[i];
        }
        else{
            to = 0;
            sum++;
            to += vt[i];
            //cout << i << endl;
        }
    }
    cout << sum << endl;
}
void You_can_do_it() {
    
}
signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int THE_wasd = 1;               
    //cin >> THE_wasd;
    while(THE_wasd--){
        never_give_up();
        //You_can_do_it();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...