Submission #1073278

# Submission time Handle Problem Language Result Execution time Memory
1073278 2024-08-24T11:40:11 Z fv3 Catfish Farm (IOI22_fish) C++17
6 / 100
62 ms 24260 KB
#include "fish.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) 
{
    vector<vector<ll>> ps(2, vector<ll>(N));

    for (int i = 0; i < M; i++)
    {
        ps[X[i]][Y[i]] = W[i];
    }

    ll suml = 0, sumr = 0;
    for (int i = 0; i < N; i++)
    {
        suml += ps[0][i];
        ps[0][i] = suml;
        sumr += ps[1][i];
        ps[1][i] = sumr;
    }

    ll res = ps[1][N-1];
    if (N > 2)
    {
        for (int i = 0; i < N; i++)
            res = max(res, ps[0][i] + ps[1][N-1] - ps[1][i]);
    }
    else
    {
        for (int i = 0; i < N; i++)
            res = max({res, ps[0][i], ps[1][i]});
    }

    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 5724 KB Output is correct
2 Correct 18 ms 6852 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
5 Runtime error 62 ms 24260 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 29 ms 9144 KB Output is correct
3 Correct 37 ms 10832 KB Output is correct
4 Correct 19 ms 5712 KB Output is correct
5 Correct 19 ms 6740 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 15 ms 5724 KB Output is correct
13 Correct 20 ms 6720 KB Output is correct
14 Correct 17 ms 5724 KB Output is correct
15 Correct 17 ms 6488 KB Output is correct
16 Correct 21 ms 5724 KB Output is correct
17 Correct 19 ms 6236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Runtime error 4 ms 3748 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Runtime error 4 ms 3748 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 5724 KB Output is correct
2 Correct 18 ms 6852 KB Output is correct
3 Correct 1 ms 2652 KB Output is correct
4 Correct 2 ms 2652 KB Output is correct
5 Runtime error 62 ms 24260 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -