Submission #935841

# Submission time Handle Problem Language Result Execution time Memory
935841 2024-02-29T16:19:19 Z Stavab Catfish Farm (IOI22_fish) C++17
0 / 100
19 ms 7772 KB
#include "fish.h"
#include <vector>
#include <algorithm>

using namespace std;

struct fish
{
    int x, y, w;

    bool operator<(const fish &f)
    {
        return x < f.x;
    }
};

vector<fish> v;
long long dp[300005][2];

long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W)
{
    v.push_back({-1, -1, -1});
    for(int i = 0; i < M; i++)
        v.push_back({X[i], Y[i], W[i]});

    sort(v.begin(), v.end());

    dp[0][0] = 0;
    dp[0][1] = 0;
    for(int i = 1; i <= M; i++)
    {
        dp[i][0] = v[i].w + dp[i - 1][1];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][1]);
    }

    return max(dp[M][0], dp[M][1]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 7772 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '23672272180683'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 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 0 ms 344 KB Output is correct
2 Correct 0 ms 428 KB Output is correct
3 Incorrect 15 ms 3996 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '15657213087870'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 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 348 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 348 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 0 ms 344 KB Output is correct
2 Correct 0 ms 428 KB Output is correct
3 Incorrect 15 ms 3996 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '15657213087870'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 7772 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '23672272180683'
2 Halted 0 ms 0 KB -