# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1080967 | allin27x | 메기 농장 (IOI22_fish) | C++17 | 1045 ms | 54488 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N= 305;
int dp[N][N][N];
int sfm[N];
int fs[N][9];
long long max_weights(signed n, signed m, std::vector<signed> x, std::vector<signed> y, std::vector<signed> w){
for (int i=0; i<m; i++) fs[x[i]][y[i]] = w[i];
for (int h0=0; h0<=n; h0++) {
for (int h1=0; h1<=n; h1++) {
if (h0 < h1) {
for (int r = h0; r<h1; r++) dp[1][h0][h1] += fs[0][r];
}
if (h0 > h1) {
for (int r = h1; r< h0; r++) dp[1][h0][h1] += fs[1][r];
}
}
}
for (int i=2; i<n; i++) {
for (int h0=0; h0<=n; h0++) {
int mx = 0; for (int t=0; t<=h0; t++) mx = max(mx, dp[i-1][t][h0]);
sfm[n] = dp[i-1][n][h0]; for (int j=n-1; j>=0; j--) sfm[j] = max(sfm[j+1], dp[i-1][j][h0]);
int s = 0; for (int h=0; h<h0; h++) s += fs[i][h]; int s1 = 0;
for (int h=0; h<=h0; h++) {
dp[i][h0][h] = max(dp[i][h0][h], s - s1 + sfm[0]); s1 += fs[i][h];
# | 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... |