Submission #1054512

# Submission time Handle Problem Language Result Execution time Memory
1054512 2024-08-12T10:22:17 Z ProtonDecay314 Catfish Farm (IOI22_fish) C++17
9 / 100
17 ms 7496 KB
#include "fish.h"

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<vpi> vvpi;
typedef vector<vpll> vvpll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef short int si;
typedef vector<si> vsi;
typedef vector<vsi> vvsi;
#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define L(varll, mn, mx) for(ll varll = (mn); varll < (mx); varll++)
#define LR(varll, mx, mn) for(ll varll = (mx); varll > (mn); varll--)
#define LI(vari, mn, mx) for(int vari = (mn); vari < (mx); vari++)
#define LIR(vari, mx, mn) for(int vari = (mx); vari > (mn); vari--)
#define INPV(varvec) for(auto& varveci : (varvec)) cin >> varveci
#define fi first
#define se second
#define pb push_back
#define INF(type) numeric_limits<type>::max()
#define NINF(type) numeric_limits<type>::min()
#define TCASES int t; cin >> t; while(t--)

ll max_weights(int N, int M, vi X, vi Y, vi W) {
    vll w(N, 0ll);

    L(i, 0ll, M) {
        w[X[i]] = W[i];
    }

    vvll dp;

    L(i, 0ll, 2ll) {
        vll dpr(N, 0ll);
        dp.pb(dpr);
    }

    L(i, 1ll, N) {
        dp[0ll][i] = max(dp[0ll][i], dp[0ll][i - 1ll]);
        dp[0ll][i] = max(dp[0ll][i], dp[1ll][i - 1ll] + w[i]);
        dp[1ll][i] = max(dp[1ll][i], dp[1ll][i - 1ll]);

        if(i > 1ll) {
            dp[1ll][i] = max(dp[1ll][i], max(dp[0ll][i - 2ll], dp[1ll][i - 2ll]) + w[i - 1ll]);          
        } else {
            dp[1ll][i] = max(dp[1ll][i], w[i - 1ll]);
        }
    }
    
    return max(dp[0ll][N - 1ll], dp[1ll][N - 1ll]);
}

# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 5016 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 348 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 2 ms 3404 KB Output is correct
2 Correct 2 ms 3404 KB Output is correct
3 Correct 15 ms 4508 KB Output is correct
4 Correct 7 ms 5072 KB Output is correct
5 Correct 15 ms 7480 KB Output is correct
6 Correct 13 ms 6728 KB Output is correct
7 Correct 15 ms 7240 KB Output is correct
8 Correct 15 ms 7496 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 2 ms 3404 KB Output is correct
2 Correct 2 ms 3404 KB Output is correct
3 Correct 15 ms 4508 KB Output is correct
4 Correct 7 ms 5072 KB Output is correct
5 Correct 15 ms 7480 KB Output is correct
6 Correct 13 ms 6728 KB Output is correct
7 Correct 15 ms 7240 KB Output is correct
8 Correct 15 ms 7496 KB Output is correct
9 Incorrect 14 ms 7240 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 17 ms 5016 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -