답안 #641866

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
641866 2022-09-17T17:27:01 Z Vanilla 메기 농장 (IOI22_fish) C++17
35 / 100
1000 ms 117648 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
const int maxn = 3002;
int64 dp [maxn][maxn][2];
int64 mx [maxn];
int64 p [maxn][maxn];
int lim = 8;

int64 max_weights(int n, int m, vector<int> x, vector<int> y,
                      vector<int> w) {
  lim = min(lim, n);
  for (int i = 0; i < m; i++) {
    p[++x[i]][++y[i]] = w[i];
  }
  for (int i = 1; i <= n; i++){
    for (int j = 1; j <= n; j++){
      p[i][j]+=p[i][j-1];
    }
  }
  for (int i = 2; i <= n; i++){
    for (int j = 0; j <= n; j++){
      dp[i][j][1] = mx[i-2] + p[i-1][j];
      for (int k = j; k <= n; k++){
        dp[i][j][0] = max(dp[i][j][0], max(dp[i-1][k][0], dp[i-1][k][1]) + p[i][k] - p[i][j]);
      }
      for (int k = 0; k <= j; k++){
        dp[i][j][1] = max(dp[i][j][1], dp[i-1][k][1] + p[i-1][j] - p[i-1][k]);
      }
      mx[i] = max({mx[i], dp[i][j][0], dp[i][j][1]});
    }
  }
  return mx[n];
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1097 ms 116732 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Execution timed out 1092 ms 117648 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1055 ms 103444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 6 ms 2004 KB Output is correct
10 Correct 42 ms 4788 KB Output is correct
11 Correct 7 ms 2004 KB Output is correct
12 Correct 37 ms 4796 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 37 ms 4848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 6 ms 2004 KB Output is correct
10 Correct 42 ms 4788 KB Output is correct
11 Correct 7 ms 2004 KB Output is correct
12 Correct 37 ms 4796 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 37 ms 4848 KB Output is correct
15 Correct 39 ms 4812 KB Output is correct
16 Correct 2 ms 980 KB Output is correct
17 Correct 48 ms 5912 KB Output is correct
18 Correct 51 ms 5792 KB Output is correct
19 Correct 49 ms 5872 KB Output is correct
20 Correct 49 ms 5792 KB Output is correct
21 Correct 47 ms 5800 KB Output is correct
22 Correct 58 ms 6856 KB Output is correct
23 Correct 39 ms 5040 KB Output is correct
24 Correct 56 ms 5452 KB Output is correct
25 Correct 37 ms 4812 KB Output is correct
26 Correct 43 ms 5084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 6 ms 2004 KB Output is correct
10 Correct 42 ms 4788 KB Output is correct
11 Correct 7 ms 2004 KB Output is correct
12 Correct 37 ms 4796 KB Output is correct
13 Correct 1 ms 980 KB Output is correct
14 Correct 37 ms 4848 KB Output is correct
15 Correct 39 ms 4812 KB Output is correct
16 Correct 2 ms 980 KB Output is correct
17 Correct 48 ms 5912 KB Output is correct
18 Correct 51 ms 5792 KB Output is correct
19 Correct 49 ms 5872 KB Output is correct
20 Correct 49 ms 5792 KB Output is correct
21 Correct 47 ms 5800 KB Output is correct
22 Correct 58 ms 6856 KB Output is correct
23 Correct 39 ms 5040 KB Output is correct
24 Correct 56 ms 5452 KB Output is correct
25 Correct 37 ms 4812 KB Output is correct
26 Correct 43 ms 5084 KB Output is correct
27 Execution timed out 1096 ms 75140 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1055 ms 103444 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1097 ms 116732 KB Time limit exceeded
2 Halted 0 ms 0 KB -