Submission #729825

# Submission time Handle Problem Language Result Execution time Memory
729825 2023-04-24T16:38:01 Z caganyanmaz Catfish Farm (IOI22_fish) C++17
6 / 100
92 ms 14688 KB
#include <bits/stdc++.h>
#define pb push_back
#define int int64_t
using namespace std;

int max_weights(int32_t n, int32_t m, vector<int32_t> x, vector<int32_t> y, vector<int32_t> w)
{
        array<vector<array<int, 2>>, 2> t;
        for (int i = 0; i < m; i++)
                if (x[i] <= 1)
                        t[x[i]].pb({y[i], w[i]});
                else
                        assert(false);
        for (int i = 0; i < 2; i++)
                sort(t[i].begin(), t[i].end());
        array<vector<int>, 2> p;
        for (int i = 0; i < 2; i++)
        {
                p[i] = vector<int>(n+1);
                int _next = 0;
                for (int j = 1; j <= n; j++)
                {
                        p[i][j] = p[i][j-1];
                        if (_next < t[i].size() && j > t[i][_next][0])
                                p[i][j] += t[i][_next++][1];
                }
        }
        int best = 0;
        for (int i = 0; i <= n; i++)
                best = max(best, p[0][i] + p[1][n] - p[1][i]);
        if (n > 2)
                return best;
        else
                return max(p[0][n], p[1][n]);
}

Compilation message

fish.cpp: In function 'int64_t max_weights(int32_t, int32_t, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:24:35: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<std::array<long int, 2> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |                         if (_next < t[i].size() && j > t[i][_next][0])
      |                             ~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 31 ms 4812 KB Output is correct
2 Correct 40 ms 5688 KB Output is correct
3 Correct 2 ms 1876 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Runtime error 92 ms 14688 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 63 ms 8008 KB Output is correct
3 Correct 77 ms 9660 KB Output is correct
4 Correct 41 ms 4800 KB Output is correct
5 Correct 43 ms 5692 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 1876 KB Output is correct
11 Correct 2 ms 1876 KB Output is correct
12 Correct 35 ms 6228 KB Output is correct
13 Correct 44 ms 7412 KB Output is correct
14 Correct 34 ms 6372 KB Output is correct
15 Correct 38 ms 7160 KB Output is correct
16 Correct 39 ms 6468 KB Output is correct
17 Correct 39 ms 7080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Runtime error 1 ms 340 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Runtime error 1 ms 340 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 4812 KB Output is correct
2 Correct 40 ms 5688 KB Output is correct
3 Correct 2 ms 1876 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Runtime error 92 ms 14688 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -