Submission #1023072

# Submission time Handle Problem Language Result Execution time Memory
1023072 2024-07-14T09:14:55 Z vjudge1 Catfish Farm (IOI22_fish) C++17
0 / 100
1000 ms 78656 KB
#include "fish.h"
#include<bits/stdc++.h>

using namespace std;

#define rall(s) s.rbegin(), s.rend()
#define all(s) s.begin(), s.end() 
#define sz(s) (int)s.size()
#define s second 
#define f first 

using ll = long long;
using pii = pair<int, int>; 
using pll = pair<ll, ll>;

const int N = 2e5 + 5;
const ll inf = 1e18;

ll c[N][10], dp[N][10][10];

long long max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) {
    int z = 0;
    for (int i = 0; i < m; i++) {
        c[x[i] + 1][y[i] + 1] = w[i];
        z = max(z, y[i] + 1);
    }
    for (int j = 0; j < z; j++) {
        for (int k = 0; k < z; k++) {
            dp[0][j][k] = (k ? -inf : 0);
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < z; j++) { 
            for (int k = 0; k < z; k++) {
                for (int s = 0; s < z; s++) {
                    ll sum = 0;
                    for (int x = k + 1; x <= max(j, s); x++) {
                        sum += c[i][x];
                    }
                    dp[i][j][k] = max(dp[i][j][k], dp[i - 1][k][s] + sum);
                }
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < z; i++) {
        ans = max(ans, dp[n][0][i]);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 6416 KB Time limit exceeded
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 Incorrect 33 ms 78656 KB 1st lines differ - on the 1st token, expected: '10082010', found: '0'
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 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 33 ms 78656 KB 1st lines differ - on the 1st token, expected: '10082010', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1060 ms 6416 KB Time limit exceeded
2 Halted 0 ms 0 KB -