답안 #871706

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871706 2023-11-11T10:53:56 Z Ludissey 메기 농장 (IOI22_fish) C++17
9 / 100
51 ms 27792 KB
#include "fish.h"
#include <bits/stdc++.h>
#define int long long
using namespace std;
vector<int> a;
vector<vector<vector<int>>> memo;
int N,M;
int dp(int x, int last, int lastlast){
  if(memo[x][last][lastlast]!=-1) return memo[x][last][lastlast];
  if(x==N){
    if(!last&&lastlast) return memo[x][last][lastlast]=a[x-1];
    return memo[x][last][lastlast]=0;
  }
  int take=dp(x+1, 1, last);
  if(last==0&&x>0) take+=a[x-1];
  int notake=dp(x+1, 0, last);
  if(lastlast==1&&last==0) notake+=a[x-1]; 
  return memo[x][last][lastlast] = max(take, notake);
}

long long max_weights(signed n, signed m, std::vector<signed> X, std::vector<signed> Y, std::vector<signed> W) {
  N=n; M=m; 
  a.resize(N, 0);
  memo.resize(N+1, vector<vector<int>>(2, vector<int>(2,-1)));
  for (int i = 0; i < M; i++) a[X[i]] = W[i];
  int p=dp(0,0,0);
  return p;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 23364 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 23816 KB Output is correct
2 Correct 26 ms 23880 KB Output is correct
3 Correct 31 ms 22612 KB Output is correct
4 Correct 30 ms 24668 KB Output is correct
5 Correct 43 ms 26248 KB Output is correct
6 Correct 42 ms 27220 KB Output is correct
7 Correct 43 ms 27732 KB Output is correct
8 Correct 51 ms 27792 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 23816 KB Output is correct
2 Correct 26 ms 23880 KB Output is correct
3 Correct 31 ms 22612 KB Output is correct
4 Correct 30 ms 24668 KB Output is correct
5 Correct 43 ms 26248 KB Output is correct
6 Correct 42 ms 27220 KB Output is correct
7 Correct 43 ms 27732 KB Output is correct
8 Correct 51 ms 27792 KB Output is correct
9 Incorrect 42 ms 27484 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 36 ms 23364 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -