Submission #1031964

# Submission time Handle Problem Language Result Execution time Memory
1031964 2024-07-23T09:12:03 Z Mr_Husanboy Catfish Farm (IOI22_fish) C++17
9 / 100
17 ms 6572 KB
#include "fish.h"
#include <bits/stdc++.h>

using namespace std;

#define ff first
#define ss second
#define all(a) (a).begin(), (a).end()
#define ll long long

template<typename T>
int len(T &a){
    return a.size();
}

mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());


long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y,
                      std::vector<int> w) {
    vector<ll> s(n);
    for(int i = 0; i < m; i++) s[x[i]] = w[i];
    vector<array<ll, 2>> dp(n);
    ll ans = 0;
    for(int i = 1; i < n; i ++){
        dp[i][0] = max(dp[i - 1][1] + s[i], dp[i - 1][0]);
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]);
        
        dp[i][1] = max(dp[i][1], (i - 2 >= 0 ? max(dp[i - 2][1], dp[i - 2][0]) : 0) + s[i - 1]);
 
        ans = max({ans, dp[i][1], dp[i][0]});
        //cout << dp[i][0] << ' ' << dp[i][1] << endl;
    }

    return ans;

}
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 5724 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2740 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 10 ms 4700 KB Output is correct
4 Correct 8 ms 4188 KB Output is correct
5 Correct 17 ms 6572 KB Output is correct
6 Correct 14 ms 5976 KB Output is correct
7 Correct 17 ms 6476 KB Output is correct
8 Correct 17 ms 6488 KB Output is correct
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory 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 -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2740 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 10 ms 4700 KB Output is correct
4 Correct 8 ms 4188 KB Output is correct
5 Correct 17 ms 6572 KB Output is correct
6 Correct 14 ms 5976 KB Output is correct
7 Correct 17 ms 6476 KB Output is correct
8 Correct 17 ms 6488 KB Output is correct
9 Incorrect 16 ms 6488 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 5724 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -