답안 #628275

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
628275 2022-08-13T09:30:18 Z c28dnv9q3 메기 농장 (IOI22_fish) C++17
14 / 100
52 ms 9496 KB
#include "fish.h"
#include <vector>
#include <cstdio>

using namespace std;
using ll = long long;

const int N_MAX = 305;
const int Y_MAX = 10;

ll pre[N_MAX][N_MAX];
ll dp[N_MAX][Y_MAX][Y_MAX];
bool got[N_MAX][Y_MAX][Y_MAX];
int N;

ll f(int i, int j, int k) {
  if (i < 0) return 0;
  if (got[i][j][k]) return dp[i][j][k];
  ll ans = f(i-1, 0, j) + pre[i][j];
  for (int l = 1; l <= 8; l++) {
    ll v = f(i-1, l, j);
    if (l < j) {
      v += pre[i][j] - pre[i][l];
    }
    if (l > j) {
      v += pre[i+1][max(l,k)] - pre[i+1][max(j,k)];
    }
    ans = max(ans, v);
  }

  got[i][j][k] = true;
  //printf("i=%d j=%d k=%d -> %lld\n", i, j, k, ans);
  return dp[i][j][k] = ans;
}

ll max_weights(
  int N, int M, vector<int> X, vector<int> Y, vector<int> W
) {
  ::N = N;
  for (int i = 0; i < M; i++)
    pre[X[i]][Y[i]+1] = W[i];
  for (int i = 0; i < N; i++)
    for (int j = 1; j <= N; j++)
      pre[i][j] += pre[i][j-1];

  return f(N-1, 0, 0);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 5716 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 52 ms 9496 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 1748 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 212 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 Correct 1 ms 724 KB Output is correct
10 Correct 3 ms 1272 KB Output is correct
11 Correct 2 ms 724 KB Output is correct
12 Correct 3 ms 1312 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 3 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 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 Correct 1 ms 724 KB Output is correct
10 Correct 3 ms 1272 KB Output is correct
11 Correct 2 ms 724 KB Output is correct
12 Correct 3 ms 1312 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 3 ms 1236 KB Output is correct
15 Incorrect 2 ms 1236 KB 1st lines differ - on the 1st token, expected: '299', found: '8'
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 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 Correct 1 ms 724 KB Output is correct
10 Correct 3 ms 1272 KB Output is correct
11 Correct 2 ms 724 KB Output is correct
12 Correct 3 ms 1312 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 3 ms 1236 KB Output is correct
15 Incorrect 2 ms 1236 KB 1st lines differ - on the 1st token, expected: '299', found: '8'
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 1748 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 27 ms 5716 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -