Submission #1043180

# Submission time Handle Problem Language Result Execution time Memory
1043180 2024-08-04T03:49:10 Z ezzzay Catfish Farm (IOI22_fish) C++17
3 / 100
53 ms 11092 KB
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#include <vector>
#define ll long long
const int MN=1e6;
ll a[MN];
ll dp[MN][2];
long long 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++){
        a[X[i]]+=W[i];
    }
    dp[0][1]=a[0];
    dp[0][0]=0;
    ll ans=a[0];
    for(int i=1;i<=N+5;i++){
        
        dp[i][1]=max(dp[i-1][0]+a[i],dp[i][1]);
        dp[i+1][0]=max(dp[i+1][0],max(dp[i-1][0],dp[i-1][1])+a[i]);
        dp[i][0]=max(dp[i-1][0],dp[i-1][1]);
        ans=max(ans,dp[i][1]);
        ans=max(ans,dp[i+1][0]);
        ans=max(ans,dp[i][0]);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 12 ms 5720 KB Output is correct
2 Correct 16 ms 6236 KB Output is correct
3 Correct 1 ms 3928 KB Output is correct
4 Correct 1 ms 4184 KB Output is correct
5 Correct 45 ms 10876 KB Output is correct
6 Correct 53 ms 11092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 25 ms 7516 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '80901044391025'
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3928 KB Output is correct
2 Correct 1 ms 3932 KB Output is correct
3 Incorrect 9 ms 4956 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359529163067'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2396 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3928 KB Output is correct
2 Correct 1 ms 3932 KB Output is correct
3 Incorrect 9 ms 4956 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359529163067'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 12 ms 5720 KB Output is correct
2 Correct 16 ms 6236 KB Output is correct
3 Correct 1 ms 3928 KB Output is correct
4 Correct 1 ms 4184 KB Output is correct
5 Correct 45 ms 10876 KB Output is correct
6 Correct 53 ms 11092 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Incorrect 25 ms 7516 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '80901044391025'
9 Halted 0 ms 0 KB -