Submission #641864

# Submission time Handle Problem Language Result Execution time Memory
641864 2022-09-17T17:24:43 Z Vanilla Catfish Farm (IOI22_fish) C++17
35 / 100
1000 ms 123028 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll up[3010][3010];
ll down[3010][3010];
ll s[3010][3010];
ll dp[3010];
 
ll max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
    for(int i=0;i<M;i++){
        s[X[i]][Y[i]+1]+=W[i];
    }
    for(int i=0;i<N;i++)
        for(int j=1;j<=N;j++)
            s[i][j]+=s[i][j-1];
    for(int i=1;i<N;i++){
        for(int j=0;j<=N;j++){
            if(i==1) up[i][j]=-s[i-1][j];
            else up[i][j]=dp[i-2] + s[i-1][j];
            for(int k=0;k<=j;k++) up[i][j]=max(up[i][j],up[i-1][k]-s[i-1][k]+s[i-1][j]);
            for(int k=j;k<=N;k++) down[i][j]=max(down[i][j],max(down[i-1][k],up[i-1][k])+s[i][k]-s[i][j]);
            dp[i]=max(dp[i],max(up[i][j],down[i][j]));
        }
    }
    return dp[N-1];
}
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 123028 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 1085 ms 120860 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 112196 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 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 5 ms 2644 KB Output is correct
10 Correct 37 ms 6076 KB Output is correct
11 Correct 5 ms 2644 KB Output is correct
12 Correct 37 ms 6048 KB Output is correct
13 Correct 2 ms 1236 KB Output is correct
14 Correct 35 ms 5956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 5 ms 2644 KB Output is correct
10 Correct 37 ms 6076 KB Output is correct
11 Correct 5 ms 2644 KB Output is correct
12 Correct 37 ms 6048 KB Output is correct
13 Correct 2 ms 1236 KB Output is correct
14 Correct 35 ms 5956 KB Output is correct
15 Correct 35 ms 5988 KB Output is correct
16 Correct 2 ms 1364 KB Output is correct
17 Correct 47 ms 7672 KB Output is correct
18 Correct 47 ms 7628 KB Output is correct
19 Correct 50 ms 7756 KB Output is correct
20 Correct 48 ms 7660 KB Output is correct
21 Correct 47 ms 7620 KB Output is correct
22 Correct 58 ms 9408 KB Output is correct
23 Correct 37 ms 6204 KB Output is correct
24 Correct 42 ms 6988 KB Output is correct
25 Correct 35 ms 5980 KB Output is correct
26 Correct 50 ms 6228 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 340 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 5 ms 2644 KB Output is correct
10 Correct 37 ms 6076 KB Output is correct
11 Correct 5 ms 2644 KB Output is correct
12 Correct 37 ms 6048 KB Output is correct
13 Correct 2 ms 1236 KB Output is correct
14 Correct 35 ms 5956 KB Output is correct
15 Correct 35 ms 5988 KB Output is correct
16 Correct 2 ms 1364 KB Output is correct
17 Correct 47 ms 7672 KB Output is correct
18 Correct 47 ms 7628 KB Output is correct
19 Correct 50 ms 7756 KB Output is correct
20 Correct 48 ms 7660 KB Output is correct
21 Correct 47 ms 7620 KB Output is correct
22 Correct 58 ms 9408 KB Output is correct
23 Correct 37 ms 6204 KB Output is correct
24 Correct 42 ms 6988 KB Output is correct
25 Correct 35 ms 5980 KB Output is correct
26 Correct 50 ms 6228 KB Output is correct
27 Execution timed out 1101 ms 75876 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 112196 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 123028 KB Time limit exceeded
2 Halted 0 ms 0 KB -