Submission #925185

# Submission time Handle Problem Language Result Execution time Memory
925185 2024-02-11T00:17:39 Z IS_Rushdi Catfish Farm (IOI22_fish) C++17
0 / 100
1000 ms 2097152 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){
    long long pre[n+2][n+2]{};
    long long dp[n+1][n+1]{};
    for(int i = 0; i < m; i++) x[i]++,y[i]++;
    for(int i = 0; i < m; i++) pre[x[i]][y[i]] += w[i];
    for(int i = 1; i <= n; i++){
        for(int j = n; j >= 0; j--){
            pre[i][j] += pre[i][j+1];
        }
    }
    for(int i = 1; i <= n; i++) dp[0][i] = -2e18;
    
    long long ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= n; j++){
            long long add = dp[i-1][j] + pre[i][j+1];
            for(int k = 0; k <= n; k++){
                long long add2 = pre[i-1][k+1];
                dp[i][k] = max(dp[i][k],add + add2);
                ans = max(ans,dp[i][k]);
            }
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1147 ms 1913012 KB Time limit exceeded
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: '4'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1056 ms 2097152 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: '3', found: '6'
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: '6'
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: '6'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1056 ms 2097152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1147 ms 1913012 KB Time limit exceeded
2 Halted 0 ms 0 KB -