Submission #858747

# Submission time Handle Problem Language Result Execution time Memory
858747 2023-10-09T05:58:07 Z sleepntsheep Catfish Farm (IOI22_fish) C++17
18 / 100
65 ms 10952 KB
#include <cstdio>
#include <cstring>
#include <cassert>
#include <string>
#include <deque>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <iostream>
#include <utility>
#include <numeric>
using namespace std;
using ll=long long;

#define N 200005
#define ALL(x) x.begin(), x.end()

int n, m, *x, *y, *w;

long long max_weights(int n_, int m_, vector<int> x_, vector<int> y_, vector<int> w_)
{
    x = x_.data();
    y = y_.data();
    w = w_.data();
    n = n_, m = m_;

    if (count_if(x, x+m, [](int x){ return x%2; }) == 0) return accumulate(w, w+m, 0ll);
    if (*max_element(x, x+m) <= 1)
    {
        vector<vector<ll>> pf(2, vector<ll>(n+1));
        for (int i = 0; i < m; ++i) pf[x[i]][y[i]] += w[i];
        for (int i = 0; i < 2; ++i)
            for (int j = 1; j < n; ++j)
                pf[i][j] += pf[i][j-1];
        ll z = max(pf[0][n-1], pf[1][n-1]);
        if (n > 2)
        {
            for (int j = 0; j < n; ++j)
                z = max(z, pf[0][j] + pf[1][n-1] - pf[1][j]);
        }
        return z;
    }
    if (*max_element(y, y+m) == 0)
    {
        vector<ll> byx(n);
        for (int i = 0; i < m; ++i) byx[x[i]] += w[i];
        vector<vector<ll>> dp(n+2, vector<ll>(3));
        dp[0][0] = 0; dp[0][1] = byx[0]; dp[1][0] = dp[0][1]; dp[1][1] = byx[1]; dp[1][2] = byx[1];
        for (int i = 2; i < n; ++i)
        {
            dp[i][0] = max({dp[i-1][2], dp[i-1][1], dp[i-1][0]});
            dp[i][1] = dp[i-1][0] + byx[i];
            dp[i][2] = dp[i-1][1] + byx[i];
        }
        return max(dp[n-1][0], dp[n-1][1]);
    }
    if (N <= 300 && *max_element(y, y+m) <= 8)
    {
    }

    return 0;
}


# Verdict Execution time Memory Grader output
1 Correct 18 ms 2392 KB Output is correct
2 Correct 22 ms 2640 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 62 ms 7248 KB Output is correct
6 Correct 65 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 36 ms 6192 KB Output is correct
3 Correct 45 ms 10952 KB Output is correct
4 Correct 18 ms 3676 KB Output is correct
5 Correct 24 ms 4536 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 600 KB Output is correct
8 Correct 1 ms 500 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 19 ms 5620 KB Output is correct
13 Correct 22 ms 6828 KB Output is correct
14 Correct 19 ms 5712 KB Output is correct
15 Correct 21 ms 6476 KB Output is correct
16 Correct 19 ms 5712 KB Output is correct
17 Correct 21 ms 6484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 6 ms 6492 KB Output is correct
3 Correct 17 ms 7224 KB Output is correct
4 Correct 14 ms 8024 KB Output is correct
5 Correct 28 ms 10424 KB Output is correct
6 Correct 26 ms 9820 KB Output is correct
7 Correct 27 ms 10588 KB Output is correct
8 Correct 27 ms 10780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
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: '0'
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: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 6 ms 6492 KB Output is correct
3 Correct 17 ms 7224 KB Output is correct
4 Correct 14 ms 8024 KB Output is correct
5 Correct 28 ms 10424 KB Output is correct
6 Correct 26 ms 9820 KB Output is correct
7 Correct 27 ms 10588 KB Output is correct
8 Correct 27 ms 10780 KB Output is correct
9 Incorrect 20 ms 3924 KB 1st lines differ - on the 1st token, expected: '99999', found: '0'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 18 ms 2392 KB Output is correct
2 Correct 22 ms 2640 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 62 ms 7248 KB Output is correct
6 Correct 65 ms 7252 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 36 ms 6192 KB Output is correct
9 Correct 45 ms 10952 KB Output is correct
10 Correct 18 ms 3676 KB Output is correct
11 Correct 24 ms 4536 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 600 KB Output is correct
14 Correct 1 ms 500 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 19 ms 5620 KB Output is correct
19 Correct 22 ms 6828 KB Output is correct
20 Correct 19 ms 5712 KB Output is correct
21 Correct 21 ms 6476 KB Output is correct
22 Correct 19 ms 5712 KB Output is correct
23 Correct 21 ms 6484 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 6 ms 6492 KB Output is correct
26 Correct 17 ms 7224 KB Output is correct
27 Correct 14 ms 8024 KB Output is correct
28 Correct 28 ms 10424 KB Output is correct
29 Correct 26 ms 9820 KB Output is correct
30 Correct 27 ms 10588 KB Output is correct
31 Correct 27 ms 10780 KB Output is correct
32 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
33 Halted 0 ms 0 KB -