Submission #925245

# Submission time Handle Problem Language Result Execution time Memory
925245 2024-02-11T07:49:48 Z IS_Rushdi Catfish Farm (IOI22_fish) C++17
23 / 100
35 ms 6492 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;


long long max_weights(int n,int m,vector<int>x,vector<int>y,vector<int>w){
    int mx = *max_element(y.begin(),y.end());
    if(mx <= 8){
        long long dp[n+1][mx+2][mx+2]{};
        int sum[n+1][mx+2]{};
        for(int i = 0; i < m; i++) x[i] += 1;
        for(int i = 0; i < m; i++) y[i] += 1;
        for(int i = 0; i < m; i++) sum[x[i]][y[i]] += w[i];
        long long ans = 0;
        
        for(int i = 0; i < 1; i++){
            for(int j = 0; j < mx+2; j++){
                for(int k = 0; k < mx+2; k++){
                    dp[i][j][k] = -1e18;
                }
            }
        }
        dp[0][0][0] = 0;
        for(int i = 1; i <= n; i++){
            for(int j = 0; j < mx+2; j++){
                for(int k = 0; k < mx+2; k++){
                    for(int v = 0; v < mx+2; v++){
                        long long now = dp[i-1][k][j];
                        int cur = v;
                        while(cur > max(j,k)) now += sum[i-1][cur--];
                        cur = k;
                        while(cur > v) now += sum[i][cur--];
                        
                        dp[i][v][k] = max(dp[i][v][k],now);
                        ans = max(ans,now);
                    }
                }
            }
        }
        return ans;
    }
    
    return -1ll;
}

// int main(){
//     cout << max_weights(5, 4, {0, 1, 4, 3}, {2, 1, 4, 3}, {5, 2, 1, 3}) << '\n';
// }
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 2140 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '-1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 35 ms 4152 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '-1'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4188 KB Output is correct
2 Correct 5 ms 4188 KB Output is correct
3 Correct 17 ms 5236 KB Output is correct
4 Correct 13 ms 5212 KB Output is correct
5 Correct 33 ms 6484 KB Output is correct
6 Correct 24 ms 6492 KB Output is correct
7 Correct 25 ms 6492 KB Output is correct
8 Correct 26 ms 6484 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 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 600 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 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 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 600 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '299', found: '-1'
16 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 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 2 ms 600 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '299', found: '-1'
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4188 KB Output is correct
2 Correct 5 ms 4188 KB Output is correct
3 Correct 17 ms 5236 KB Output is correct
4 Correct 13 ms 5212 KB Output is correct
5 Correct 33 ms 6484 KB Output is correct
6 Correct 24 ms 6492 KB Output is correct
7 Correct 25 ms 6492 KB Output is correct
8 Correct 26 ms 6484 KB Output is correct
9 Incorrect 22 ms 2652 KB 1st lines differ - on the 1st token, expected: '99999', found: '-1'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 2140 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '-1'
2 Halted 0 ms 0 KB -