답안 #833689

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
833689 2023-08-22T07:55:07 Z ALeonidou 메기 농장 (IOI22_fish) C++17
0 / 100
19 ms 7764 KB
#include "fish.h"
#include <bits/stdc++.h>

using namespace std;
#define ll int
#define sz(x) (ll)x.size()
#define F first
#define S second
#define pb push_back
#define MID ((l+r)/2)
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;

typedef vector <ll> vi;
typedef vector <long long > vl;
typedef pair <ll,ll> ii;
typedef vector <ii> vii;


void printVct(vl &v, string s = ""){
    cout<<s<<": ";
    for (ll i=0; i<sz(v); i++){
        cout<<v[i]<<" ";
    }
    cout<<endl;
}

ll n,m;
vl arr, dp;
long long solve(ll c){
    if (c >= n-1) return 0;
    if (dp[c] == -1){
        dp[c] = max(arr[c+1] + solve(c+2), solve(c+1));
    }
    return dp[c];
}

long long max_weights(int N, int M, vi X, vi Y, vi W) {
    n= N, m =M;
    long long ans = 0;

    dp.assign(n, -1);
    arr.assign(n, 0);
    for (ll i =0 ; i<m; i++){
        arr[X[i]] = W[i];
    }
    
    long long a = solve(0);
    long long b = solve(1) + arr[0];
    ans = max(a,b);
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 7764 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 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 6484 KB Output is correct
2 Correct 5 ms 6484 KB Output is correct
3 Incorrect 15 ms 7124 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341'
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 6484 KB Output is correct
2 Correct 5 ms 6484 KB Output is correct
3 Incorrect 15 ms 7124 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 7764 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -