Submission #729824

# Submission time Handle Problem Language Result Execution time Memory
729824 2023-04-24T16:32:22 Z caganyanmaz Catfish Farm (IOI22_fish) C++17
0 / 100
86 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]);
        return best;
}

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 32 ms 4816 KB Output is correct
2 Correct 42 ms 5756 KB Output is correct
3 Correct 2 ms 1748 KB Output is correct
4 Correct 2 ms 1876 KB Output is correct
5 Runtime error 86 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 62 ms 8064 KB Output is correct
3 Correct 86 ms 11280 KB Output is correct
4 Correct 37 ms 6196 KB Output is correct
5 Correct 45 ms 7460 KB Output is correct
6 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
7 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 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 32 ms 4816 KB Output is correct
2 Correct 42 ms 5756 KB Output is correct
3 Correct 2 ms 1748 KB Output is correct
4 Correct 2 ms 1876 KB Output is correct
5 Runtime error 86 ms 14688 KB Execution killed with signal 6
6 Halted 0 ms 0 KB -