Submission #778791

# Submission time Handle Problem Language Result Execution time Memory
778791 2023-07-10T16:51:32 Z YassirSalama Catfish Farm (IOI22_fish) C++17
9 / 100
31 ms 10048 KB
#include "fish.h"
#include<bits/stdc++.h>
#include <vector>
using namespace std;
#define all(v) v.begin(),v.end()
const int MAXN=1e5+1000;
// long long dp[MAXN][2];//0 last one is not built, 1 last one is built
vector<int> v(MAXN,0);
int n;
int m;
long long max_weights(int N, int M, vector<int> X, vector<int> Y,
                      vector<int> W) {
    for(int i=0;i<M;i++) v[X[i]]+=W[i];
    n=N;
    m=M;
    vector<vector<long long>> dp(MAXN,vector<long long>(2,0));
    for(int i=1;i<=n;i++){
        dp[i][1]=dp[i-1][1];
        if(i>1) dp[i][1]=max(dp[i-1][1],max(dp[i-2][1],dp[i-2][0])+v[i-1]);
        else dp[i][1]=v[i-1];
        dp[i][0]=max(dp[i-1][0],dp[i-1][1]+v[i]);
    }
    // for(int i=1;i<=n;i++) cout<<dp[i]<<" ";
    return *max_element(all(dp[n-1]));
}
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 8160 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '709728670'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 6204 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 6228 KB Output is correct
2 Correct 6 ms 6228 KB Output is correct
3 Correct 17 ms 7508 KB Output is correct
4 Correct 14 ms 6996 KB Output is correct
5 Correct 26 ms 8536 KB Output is correct
6 Correct 30 ms 9420 KB Output is correct
7 Correct 30 ms 10040 KB Output is correct
8 Correct 31 ms 10048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 6228 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 7 ms 6228 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 7 ms 6228 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 6 ms 6228 KB Output is correct
2 Correct 6 ms 6228 KB Output is correct
3 Correct 17 ms 7508 KB Output is correct
4 Correct 14 ms 6996 KB Output is correct
5 Correct 26 ms 8536 KB Output is correct
6 Correct 30 ms 9420 KB Output is correct
7 Correct 30 ms 10040 KB Output is correct
8 Correct 31 ms 10048 KB Output is correct
9 Incorrect 26 ms 9912 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 8160 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '709728670'
2 Halted 0 ms 0 KB -