Submission #1117685

#TimeUsernameProblemLanguageResultExecution timeMemory
1117685vjudge1Paprike (COI18_paprike)C++17
13 / 100
53 ms1620 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, k, s = 0, ans = 0; cin >> n >> k; vector<int> h(n); vector<pair<int, int>> e(n - 1); for (int &s : h) { cin >> s; } for (auto &[a, b] : e) { cin >> a >> b; a--; b--; } for (int i = 0; i < n; i++) { s += h[i]; if (s > k) { ans++; s = h[i]; } } cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...