답안 #834254

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
834254 2023-08-22T12:21:52 Z gagik_2007 메기 농장 (IOI22_fish) C++17
14 / 100
754 ms 154468 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define ff first
#define ss second

ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=3007;
ll n,m,k;
ll pf[N][N];
ll dp[N][20][20];

ll max_weights(int NN, int MM, vector<int> X, vector<int> Y, vector<int> W) {
    n=NN;
    m=MM;
    for(int i=0;i<m;i++){
        pf[X[i]][Y[i]+1]=W[i];
    }
    for(int i=0;i<n;i++){
        for(int j=1;j<max(n,10ll);j++){
            pf[i][j]+=pf[i][j-1];
        }
    }
    for(int i=0;i<=9;i++){
        // cout<<dp[0][1][1]<<endl;
        dp[0][0][i]=pf[1][i];
        // cout<<"0, 0, "<<i<<": "<<dp[0][0][i]<<endl;
    }
    // cout<<endl;
    ll ans=0;
    for(int i=1;i<n;i++){
        for(int j=0;j<=9;j++){
            for(int k=0;k<=9;k++){
                // cout<<i<<", "<<k<<", "<<j<<": ";
                for(int p=0;p<=9;p++){
                    // cout<<p<<": ";
                    ll res=dp[i-1][p][k];
                    // cout<<i-1<<" "<<p<<" "<<k<<": "<<dp[i-1][p][k]<<" ";
                    res-=pf[i][min(k,j)];
                    // cout<<res<<" ";
                    if(j>p&&j>k){
                        res+=pf[i-1][j]-pf[i-1][max(p,k)];
                    }
                    // cout<<res<<" ";
                    if(i!=n-1){
                        res+=pf[i+1][j];
                    }
                    dp[i][k][j]=max(dp[i][k][j],res);
                    // cout<<res<<",   ";
                }
                ans=max(ans,dp[i][k][j]);
                // cout<<dp[i][k][j]<<"\n";
            }
            // cout<<endl;
        }
        // cout<<endl;
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 730 ms 148540 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Runtime error 713 ms 154468 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 754 ms 143932 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 3 ms 3156 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 4 ms 3156 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 2 ms 3156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 3 ms 3156 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 4 ms 3156 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 2 ms 3156 KB Output is correct
15 Incorrect 3 ms 3128 KB 1st lines differ - on the 1st token, expected: '299', found: '9'
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 1492 KB Output is correct
10 Correct 3 ms 3156 KB Output is correct
11 Correct 1 ms 1492 KB Output is correct
12 Correct 4 ms 3156 KB Output is correct
13 Correct 1 ms 852 KB Output is correct
14 Correct 2 ms 3156 KB Output is correct
15 Incorrect 3 ms 3128 KB 1st lines differ - on the 1st token, expected: '299', found: '9'
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 754 ms 143932 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 730 ms 148540 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -