답안 #995575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
995575 2024-06-09T11:47:26 Z cpdreamer 메기 농장 (IOI22_fish) C++17
0 / 100
1000 ms 2097152 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <utility>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int,null_type,less<int>,rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;
const int max_n=INT_MAX;
typedef long long  ll;
#define LLM LONG_LONG_MAX
#define pb push_back
#define F first
#define L length()
#define all(v) v.begin(),v.end()
#define V vector
#define S second
const long long MOD = 1000000007; // 1e9 + 7


long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
    V<V<ll>>grid(N+1,V<ll>(N+1,0));
    for(int i=0;i<M;i++)
        grid[X[i]][Y[i]+1]+=W[i];
    for(int i=0;i<N;i++){
        for(int j=1;j<=N;j++)
            grid[i][j]+=grid[i][j-1];
    }
    ll dp[N][N+1][3];
    memset(dp,0,sizeof(dp));
    for(int i=0;i<=N;i++){
        for(int j=0;j<=i;j++){
            for(int g=0;g<=j;g++){
                dp[1][i][0]=max(dp[1][i][0],grid[1][i]-grid[1][j]+grid[0][j]-grid[0][g]);
            }
        }
        for(int j=i;j<=N;j++){
            for(int g=j;g<=N;g++){
                dp[1][i][1]=max(dp[1][i][1],grid[1][g]-grid[1][j]+grid[2][j]-grid[2][i]);
            }
        }
        for(int j=i;j<=N;j++){
            for(int g=0;g<=j;g++){
                dp[1][i][2]=max(dp[1][i][2],grid[0][j]-grid[0][g]+grid[2][j]-grid[2][i]);
            }
        }
    }
    for(int i=2;i<N;i++){
        for(int j=0;j<=N;j++){
            for(int g=0;g<=j;g++){
                dp[i][j][0]=max(dp[i][j][0],dp[i-1][g][0]+grid[i][j]-grid[i][g]);
            }
            for(int g=j;g<=N;g++){
                dp[i][j][1]=max(dp[i][j][1],max(dp[i-1][g][1],dp[i-1][g][2])+grid[i+1][g]-grid[i+1][j]);
            }
            for(int g=j;g<=N;g++){
                dp[i][j][2]=max(dp[i][j][2],dp[i-1][g][0]+grid[i+1][g]-grid[i+1][j]);
            }
        }
    }
    return max(dp[N-1][0][1],dp[N-1][0][2]);
}
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1128 ms 2097152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 987 ms 2097152 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 919 ms 2097152 KB Execution killed with signal 9
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 0 ms 348 KB Output is correct
9 Incorrect 7 ms 1112 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '7818664569'
10 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 0 ms 348 KB Output is correct
9 Incorrect 7 ms 1112 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '7818664569'
10 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 0 ms 348 KB Output is correct
9 Incorrect 7 ms 1112 KB 1st lines differ - on the 1st token, expected: '216624184325', found: '7818664569'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 919 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1128 ms 2097152 KB Time limit exceeded
2 Halted 0 ms 0 KB -