# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
729824 | caganyanmaz | Catfish Farm (IOI22_fish) | C++17 | 86 ms | 14688 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |