| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1353395 | Alex1298 | Lawn Mower (CEOI25_lawnmower) | C++20 | 2094 ms | 2204 KiB |
#include <iostream>
#include <vector>
using namespace std;
int n, c, b;
int timp[200005];
int cant[200005];
long long dp[200005];
long long INF = (1LL << 60);
long long mow(int N, int C, int B, std::vector<int> &A, std::vector<int> &V)
{
n = N;
c = C;
b = B;
for(int i = 0; i<n; i++)
{
timp[i + 1] = A[i];
cant[i + 1] = V[i];
}
dp[n + 1] = 0;
for(int i = n; i>=1; i--)
{
long long timp_add = 0;
dp[i] = INF;
int sum = 0;
for(int j = i; j<=n; j++)
{
if(sum == c)
{
break;
timp_add += b;
sum = 0;
}
if(cant[j] <= c - sum)
{
timp_add += timp[j];
sum += cant[j];
}
else
{
int temp = cant[j] - (c - sum);
timp_add += timp[j] + b;
sum = 0;
int cnt = (temp + c - 1) / c;
timp_add += 1LL * cnt * timp[j];
timp_add += 1LL * (cnt - 1) * b;
if(temp % c == 0)
{
sum = c;
}
else
{
sum = temp % c;
}
}
dp[i] = min(dp[i], timp_add + b + dp[j + 1]);
}
}
return dp[1];
}| # | 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... | ||||
