답안 #626281

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
626281 2022-08-11T10:52:28 Z dariasc 메기 농장 (IOI22_fish) C++17
9 / 100
30 ms 4180 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define vec vector
#define ll long long

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {

  ll fish[N];
  memset(fish, 0, sizeof fish);
  for (int i = 0; i < M; i++) {
    fish[X[i]] = W[i];
  }

  ll dp[N];
  memset(dp, 0, sizeof dp);
  for (int x = 0; x < N; x++) {
    ll l = 0;
    if (x > 0) {
      l = fish[x-1];
    }
    ll r = 0;
    if (x < N-1) {
      r = fish[x+1];
    }
    dp[x] = l + r;
    if (x > 2) {
      dp[x] += dp[x-3];
    }

    if (x > 1) {
      dp[x] = max(dp[x], dp[x-2] + r);
    }
    if (x > 0) {
      dp[x] = max(dp[x], dp[x-1] - fish[x] + r);
    }
  }

  ll best = 0;
  for (int x = 0; x < N; x++) {
    best = max(best, dp[x]);
  }

  return best;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 3532 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 2 ms 1748 KB Output is correct
2 Correct 2 ms 1748 KB Output is correct
3 Correct 16 ms 2860 KB Output is correct
4 Correct 12 ms 2660 KB Output is correct
5 Correct 30 ms 4180 KB Output is correct
6 Correct 24 ms 4176 KB Output is correct
7 Correct 28 ms 4152 KB Output is correct
8 Correct 27 ms 4176 KB Output is correct
# 결과 실행 시간 메모리 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 2 ms 1748 KB Output is correct
2 Correct 2 ms 1748 KB Output is correct
3 Correct 16 ms 2860 KB Output is correct
4 Correct 12 ms 2660 KB Output is correct
5 Correct 30 ms 4180 KB Output is correct
6 Correct 24 ms 4176 KB Output is correct
7 Correct 28 ms 4152 KB Output is correct
8 Correct 27 ms 4176 KB Output is correct
9 Incorrect 28 ms 4156 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 3532 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -