| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1334857 | opeleklanos | 메기 농장 (IOI22_fish) | C++20 | 413 ms | 34072 KiB |
// #include <algorithm>
#include <vector>
#include <iostream>
// #include <queue>
using namespace std;
#define ll long long
vector<vector<ll>> dp;
vector<vector<ll>> g;
ll n;
ll calcDp(ll ind, int p){
if(dp[ind][p] != -1) return dp[ind][p];
if(ind == 0){
return dp[ind][p] = 0;
}
for(int i = 0; i<10; i++){
ll tmp = calcDp(ind-1, i);
for(auto j = i; j< p; j++){
tmp += g[ind-1][j];
}
dp[ind][p] = max(dp[ind][p], tmp);
}
if(ind == 1) return dp[ind][p];
for(int i = 0; i<10; i++){
for(int j = 0; j<10; j++){
ll tmp = calcDp(ind-2, i);
for(int c = j; c<max(i, p); c++){
tmp += g[ind-1][c];
}
dp[ind][p] = max(dp[ind][p], tmp);
}
}
return dp[ind][p];
}
ll max_weights(int n1, int m, vector<int> x1, vector<int> y1, vector<int>w1){
n = n1;
g.assign(n, vector<ll>(10, 0));
dp.assign(n+1, vector<ll>(10, -1));
for(int i = 0; i<m; i++){
g[x1[i]][y1[i]] = w1[i];
}
return calcDp(n, 0);
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
