# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
652456 | Blagoj | Catfish Farm (IOI22_fish) | C++17 | 114 ms | 7264 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 "fish.h"
#include <bits/stdc++.h>
using namespace std;
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
bool Even = true, Less = true;
long long sum1 = 0, sum2 = 0;
for (auto x : X)
{
if (x % 2 != 0)
{
Even = false;
}
if (x > 1)
{
Less = false;
}
}
if (Even)
{
long long sum = 0;
for (auto x : W)
{
sum += x;
}
return sum;
}
if (Less)
{
long long m[N + 3][3];
memset(m, 0, sizeof(m));
for (int i = 0; i < M; i++)
{
m[Y[i]][X[i]] = W[i];
}
for (int i = 1; i < N; i++)
{
m[i][0] += m[i - 1][0];
m[i][1] += m[i - 1][1];
}
long long ans = max(m[N - 1][0], m[N - 1][1]);
if (N == 2)
{
return ans;
}
for (int i = 0; i < N; i++)
{
ans = max(ans, m[i][0] + m[N - 1][1] - m[i][1]);
}
return ans;
}
}
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... |