답안 #1068407

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068407 2024-08-21T09:44:05 Z Unforgettablepl 메기 농장 (IOI22_fish) C++17
35 / 100
1000 ms 1872044 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){
    vector DP(N+1,vector(N+1,vector(2,0ll)));
    vector pref(N+1,vector(N+1,0ll));
    for(int i=0;i<M;i++) {
        pref[X[i]+1][Y[i]+1]=W[i];
    }
    for(int i=1;i<=N;i++)for(int j=1;j<=N;j++)pref[i][j]+=pref[i][j-1];
    for(int i=2;i<=N;i++) {
        for(int j=0;j<=N;j++) {
            for(int x=j;x<=N;x++) {
                DP[i][j][1]=max(DP[i][j][1],pref[i][x]-pref[i][j]+max(DP[i-1][x][0],DP[i-1][x][1]));
            }
            if(i>2) {
                for(int x=0;x<=N;x++) {
                    DP[i][j][0]=max(DP[i][j][0],pref[i-1][max(x,j)]+max(DP[i-2][x][0],DP[i-2][x][1]));
                }
            }
            for(int x=0;x<=j;x++) {
                DP[i][j][0]=max(DP[i][j][0],pref[i-1][j]-pref[i-1][x]+DP[i-1][x][0]);
            }
        }
    }
    long long ans = 0;
    for(int j=0;j<=N;j++)ans=max(ans,DP[N][j][0]);
    for(int j=0;j<=N;j++)ans=max(ans,DP[N][j][1]);
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1150 ms 1767508 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Execution timed out 1163 ms 1872044 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1151 ms 1686116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 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 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 9 ms 1884 KB Output is correct
10 Correct 67 ms 5980 KB Output is correct
11 Correct 9 ms 1884 KB Output is correct
12 Correct 66 ms 6152 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 67 ms 5980 KB Output is correct
# 결과 실행 시간 메모리 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 0 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 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 9 ms 1884 KB Output is correct
10 Correct 67 ms 5980 KB Output is correct
11 Correct 9 ms 1884 KB Output is correct
12 Correct 66 ms 6152 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 67 ms 5980 KB Output is correct
15 Correct 69 ms 5980 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 76 ms 7772 KB Output is correct
18 Correct 80 ms 7772 KB Output is correct
19 Correct 78 ms 7928 KB Output is correct
20 Correct 74 ms 7772 KB Output is correct
21 Correct 81 ms 7932 KB Output is correct
22 Correct 84 ms 9556 KB Output is correct
23 Correct 69 ms 6232 KB Output is correct
24 Correct 71 ms 7292 KB Output is correct
25 Correct 68 ms 6156 KB Output is correct
26 Correct 73 ms 6276 KB Output is correct
# 결과 실행 시간 메모리 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 0 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 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 9 ms 1884 KB Output is correct
10 Correct 67 ms 5980 KB Output is correct
11 Correct 9 ms 1884 KB Output is correct
12 Correct 66 ms 6152 KB Output is correct
13 Correct 2 ms 604 KB Output is correct
14 Correct 67 ms 5980 KB Output is correct
15 Correct 69 ms 5980 KB Output is correct
16 Correct 2 ms 860 KB Output is correct
17 Correct 76 ms 7772 KB Output is correct
18 Correct 80 ms 7772 KB Output is correct
19 Correct 78 ms 7928 KB Output is correct
20 Correct 74 ms 7772 KB Output is correct
21 Correct 81 ms 7932 KB Output is correct
22 Correct 84 ms 9556 KB Output is correct
23 Correct 69 ms 6232 KB Output is correct
24 Correct 71 ms 7292 KB Output is correct
25 Correct 68 ms 6156 KB Output is correct
26 Correct 73 ms 6276 KB Output is correct
27 Execution timed out 1043 ms 564560 KB Time limit exceeded
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1151 ms 1686116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1150 ms 1767508 KB Time limit exceeded
2 Halted 0 ms 0 KB -