제출 #1293947

#제출 시각아이디문제언어결과실행 시간메모리
1293947ezim1234Paprike (COI18_paprike)C++20
13 / 100
24 ms16712 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() #define yes cout << "Yes" << "\n" #define no cout << "No" << "\n" #define pb push_back #define F first #define S second typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair <int, int> pii; typedef vector <pii> vii; typedef vector <ll> vi; template<typename T> void read(vector<T>& v) { for (auto &x : v) cin >> x; } template<typename T> void print(const vector<T>& v) { for (auto &x : v) cout << x << ' '; cout << "\n"; } const ll MAX = 1e6 + 5; const ll MOD = 1e9 + 7; vi b(MAX); vi c(MAX); void solve() { int n, k; cin >> n >> k; vi a(n); read(a); for (int i = 0; i < n - 1; i++) { int b, c; cin >> b >> c; } int cem = 0; int say = 0; for (auto x : a) { if (cem + x > k) { say++; cem = 0; } cem += x; } cout << say << '\n'; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; for (int i = 1; i <= t; i++) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...