Submission #1076244

# Submission time Handle Problem Language Result Execution time Memory
1076244 2024-08-26T12:10:44 Z vjudge1 Catfish Farm (IOI22_fish) C++17
9 / 100
953 ms 2097152 KB
#include "fish.h"

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vll = vector<ll>;

ll max_weights(int n, int m, vi X, vi Y, vi W) {
    int maxy = 0;
    for(int i = 0; i < m; ++i) {
        ++Y[i];
        maxy = max(maxy, Y[i]);
    }
    vector<vector<ll> > C(n, vll(maxy + 1, 0));
    for(int i = 0; i < m; ++i) {
        C[X[i]][Y[i]] = W[i];
    }

    const ll INF = 1e9;
    vector<vector<vll> > DP(n + 1, vector(maxy + 1, vll(maxy + 1, -INF)));
    DP[0][0][0] = 0;
    ll re = 0;
    for(int i = 0; i < n; ++i) {
        for(int h2 = 0; h2 <= maxy; ++h2) {
            for(int h1 = 0; h1 <= maxy; ++h1) {
                ll cost0 = 0;
                for(int j = 0; j <= maxy; ++j) {
                    if(j <= h1) cost0 += C[i][j];
                }
                if(!i) cost0 = 0;

                for(int h = 0; h <= maxy; ++h) {
                    ll cnou = 0;
                    for(int j = 0; j <= maxy; ++j) {
                        if(j > h && j <= h1) cnou += C[i][j];
                        if(j <= h && i + 1 < n) cnou += C[i + 1][j];
                        if(j <= h && j > h1 && j > h2 && i) cnou += C[i - 1][j];
                    }
                    DP[i + 1][h1][h] = max(DP[i + 1][h1][h], DP[i][h2][h1] + cnou - cost0);
                    re = max(re, DP[i + 1][h1][h]);
                }
            }
        }
    }
    return re;
}
# Verdict Execution time Memory Grader output
1 Runtime error 953 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 941 ms 2097152 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 20616 KB Output is correct
2 Correct 32 ms 20740 KB Output is correct
3 Correct 37 ms 20916 KB Output is correct
4 Correct 37 ms 22108 KB Output is correct
5 Correct 53 ms 24636 KB Output is correct
6 Correct 45 ms 23940 KB Output is correct
7 Correct 50 ms 24476 KB Output is correct
8 Correct 47 ms 24640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 444 KB Output is correct
10 Incorrect 5 ms 604 KB 1st lines differ - on the 1st token, expected: '799839985182', found: '800337535564'
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 444 KB Output is correct
10 Incorrect 5 ms 604 KB 1st lines differ - on the 1st token, expected: '799839985182', found: '800337535564'
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 444 KB Output is correct
10 Incorrect 5 ms 604 KB 1st lines differ - on the 1st token, expected: '799839985182', found: '800337535564'
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 20616 KB Output is correct
2 Correct 32 ms 20740 KB Output is correct
3 Correct 37 ms 20916 KB Output is correct
4 Correct 37 ms 22108 KB Output is correct
5 Correct 53 ms 24636 KB Output is correct
6 Correct 45 ms 23940 KB Output is correct
7 Correct 50 ms 24476 KB Output is correct
8 Correct 47 ms 24640 KB Output is correct
9 Runtime error 884 ms 2097152 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 953 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -