답안 #627558

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
627558 2022-08-12T16:52:42 Z c28dnv9q3 메기 농장 (IOI22_fish) C++17
0 / 100
31 ms 10032 KB
#include "fish.h"
#include <vector>

using namespace std;
using ll = long long;

const int N_MAX = 100005;

ll v[N_MAX];
ll dp[N_MAX];
bool got[N_MAX];

ll f(int i) {
  if (i == 0) return 0;
  if (got[i]) return dp[i];
  ll ans = f(i-1);
  if (i == 1) {
    ans = max(v[0], v[1]);
  } else if (i == 2) {
    ans = max(ans, v[0] + v[2]);
  }
  if (i >= 3) {
    ans = max(ans, f(i-3) + v[i] + v[i-2]);
  }
  if (i >= 4) {
    ans = max(ans, f(i-4) + v[i] + v[i-3]);
  }

  got[i] = true;
  return dp[i] = ans;
}

ll max_weights(
  int N, int M, vector<int> X, vector<int> Y, vector<int> W
) {
  for (int i = 0; i < M; i++)
    v[X[i]] = W[i];

  return f(N-1);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 9972 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8916 KB Output is correct
2 Correct 6 ms 8916 KB Output is correct
3 Incorrect 20 ms 10032 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '20830673299350'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 8916 KB Output is correct
2 Correct 6 ms 8916 KB Output is correct
3 Incorrect 20 ms 10032 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '20830673299350'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 9972 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -