답안 #831526

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
831526 2023-08-20T10:10:38 Z MrDeboo 메기 농장 (IOI22_fish) C++17
17 / 100
1000 ms 10156 KB
#include "fish.h"
#include "bits/stdc++.h"
#define int long long
using namespace std;
map<pair<int,pair<int,int>>,int>dp;
int vct[311][311];
int vctt[311][311];
vector<int>v[311];
int N;
int slv(int a,int b,int c){
    if(a==N)return 0;
    if(dp.count({a,{b,c}}))return dp[{a,{b,c}}];
    // cerr<<a<<' '<<b<<endl;
    int mx=0;
    int tot=0;
    for(auto &i:v[a]){
        if(i<=b)tot-=vct[a][i];
        if(i>max(b,c))tot+=vct[a-1][i];
        tot+=vct[a+1][i];
        mx=max(mx,slv(a+1,i,b)+tot);
    }
    return dp[{a,{b,c}}]=mx;
}
long long max_weights(int32_t n, int32_t m, std::vector<int32_t> x, std::vector<int32_t> y, std::vector<int32_t> w) {
    N=n;
    if(n>300){
        int g=0;
        for(auto &i:w)g+=i;
        return g;
    }
    for(int i=0;i<=n;i++)v[i].push_back(0);
    for(int i=0;i<m;i++){
        vct[x[i]][y[i]+1]=w[i];
        if(x[i])v[x[i]-1].push_back(y[i]+1);
        v[x[i]].push_back(y[i]+1);
        v[x[i]+1].push_back(y[i]+1);
    }
    for(int i=0;i<=n;i++)sort(v[i].begin(),v[i].end());
    for(int i=0;i<=n;i++)v[i].resize(unique(v[i].begin(),v[i].end())-v[i].begin());
    return slv(0,0,0);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 2160 KB Output is correct
2 Correct 21 ms 2652 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 66 ms 7244 KB Output is correct
6 Correct 67 ms 7284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 45 ms 4008 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '80901044391025'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 12 ms 1472 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 248 KB Output is correct
3 Correct 0 ms 212 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 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 2 ms 980 KB Output is correct
10 Correct 21 ms 2992 KB Output is correct
11 Correct 10 ms 1620 KB Output is correct
12 Correct 18 ms 2548 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 7 ms 1800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 248 KB Output is correct
3 Correct 0 ms 212 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 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 2 ms 980 KB Output is correct
10 Correct 21 ms 2992 KB Output is correct
11 Correct 10 ms 1620 KB Output is correct
12 Correct 18 ms 2548 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 7 ms 1800 KB Output is correct
15 Correct 2 ms 1364 KB Output is correct
16 Execution timed out 1073 ms 10156 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 248 KB Output is correct
3 Correct 0 ms 212 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 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 2 ms 980 KB Output is correct
10 Correct 21 ms 2992 KB Output is correct
11 Correct 10 ms 1620 KB Output is correct
12 Correct 18 ms 2548 KB Output is correct
13 Correct 1 ms 596 KB Output is correct
14 Correct 7 ms 1800 KB Output is correct
15 Correct 2 ms 1364 KB Output is correct
16 Execution timed out 1073 ms 10156 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 12 ms 1472 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722970331638'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 2160 KB Output is correct
2 Correct 21 ms 2652 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 66 ms 7244 KB Output is correct
6 Correct 67 ms 7284 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Incorrect 45 ms 4008 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '80901044391025'
9 Halted 0 ms 0 KB -