| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1361844 | avighna | Legendary Dango Eater (JOI26_dango) | C++20 | 2595 ms | 12268 KiB |
#include <bits/stdc++.h>
using namespace std;
int64_t solve(vector<int64_t> a, int64_t k) {
int64_t ans = 0, sum = 0;
for (auto &x : a) {
sum += x;
if (x < 0 || sum <= 0) {
sum = max(sum, int64_t(0));
continue;
}
ans += sum / k;
sum %= k;
}
return ans;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n, q;
int64_t k;
cin >> n >> q >> k;
vector<int64_t> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
if (i & 1) {
a[i] = -a[i];
}
}
while (q--) {
int l, r;
cin >> l >> r;
--l, --r;
vector<int64_t> b;
for (int i = l; i <= r; ++i) {
b.push_back(a[i]);
}
cout << solve(b, k) << '\n';
}
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
