| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1353402 | Alex1298 | Lawn Mower (CEOI25_lawnmower) | C++20 | 3 ms | 2628 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;
int gata = 0;
for(int j = i; j<=n && gata == 0; j++)
{
if(sum == c)
{
break;
}
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;
}
gata = 1;
}
dp[i] = min(dp[i], timp_add + b + dp[j + 1]);
}
}
return dp[1];
}| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
