답안 #641832

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
641832 2022-09-17T16:26:24 Z Vanilla 메기 농장 (IOI22_fish) C++17
0 / 100
180 ms 12464 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int64;
const int maxn = 302;
int64 dp [maxn][maxn][2];
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 = 0; i <= n; i++){
    dp[1][i][0] = dp[1][i][1] = p[2][i];
  }
  for (int i = 2; i <= n; i++){
    for (int j = 0; j <= n; j++){
      for (int k = 0; k <= n; k++){
        if (j >= k) {
          dp[i][j][1] = max(dp[i][j][1], dp[i-1][k][1] - p[i][j] + p[i+1][j] + (p[i-1][j] - p[i-1][k]));
        }
        if (j <= k) {
          dp[i][j][0] = max(dp[i][j][0], max(dp[i-1][k][0], dp[i-1][k][1]) - p[i][j] + p[i+1][j]);
        }
      }
    }
  }
  int64 rs = 0;
  for (int i = 0; i <= n; i++){
    rs = max({rs, dp[n][i][0], dp[n][i][1]});
  }
  return rs;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 160 ms 8544 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 180 ms 12464 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 143 ms 4708 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 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 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 13 ms 1312 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '6924732913'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 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 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 13 ms 1312 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '6924732913'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 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 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 13 ms 1312 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '6924732913'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 143 ms 4708 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 160 ms 8544 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -