Submission #628461

# Submission time Handle Problem Language Result Execution time Memory
628461 2022-08-13T12:14:33 Z Ronin13 Catfish Farm (IOI22_fish) C++17
0 / 100
1000 ms 64584 KB
#include "fish.h"
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
#include <vector>
using namespace std;

const int NMAX = 3005;
ll dp[NMAX][NMAX];//klebadi
ll DP[NMAX][NMAX];//zrdadi
ll val[NMAX][NMAX];
const ll linf = 1e18;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
    int n = N;
    int m = M;
    for(int i = 0; i < m; i++){
        val[X[i] + 1][Y[i] + 1] = W[i];
    }
    /*for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++) cout << val[i][j] << ' ';
        cout << "\n";
    }*/


    DP[0][0] = 0;
    for(int i = 1; i <= n + 1; i++){
        if(i != 1){for(int j = n; j >= 1; j--){
            if(j == n){
                if(i > 1) dp[i][j] = DP[i - 2][j] + val[i][j];
            }
            else dp[i][j] = max(dp[i - 1][j + 1], dp[i][j + 1]) + val[i][j];
            dp[i][j] = max(dp[i][j], dp[i - 1][j]);
        }}
        for(int j = 1; j <= n; j++){
            if(j == 1)DP[i][j] = dp[i - 1][j] + val[i][j];
            else DP[i][j] = max(DP[i - 1][j - 1], DP[i][j - 1]) + val[i][j];
            DP[i][j] = max(DP[i - 1][j], DP[i][j]);
        }
    }
    /*for(int i = 1; i <= n + 1; i++){
        for(int j = 1; j <= n; j++) cout << dp[i][j] << ' ';
        cout << "\n";
    }*/

    return dp[n + 1][1];
    return 0;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 64324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 340 KB Output is correct
2 Execution timed out 1097 ms 64584 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1099 ms 56884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Incorrect 2 ms 2516 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Incorrect 2 ms 2516 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Incorrect 2 ms 2516 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '214837477243'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1099 ms 56884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 64324 KB Time limit exceeded
2 Halted 0 ms 0 KB -