# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
849329 | sonamoo | Catfish Farm (IOI22_fish) | C++17 | 69 ms | 9584 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>
#define MAX 200005
#define INF 1e12
#define ll long long
#define pii pair<int,int>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
vector<pair<ll,ll> > fish;
long long ans;
long long a1[100005] , a2[100005] , ps1[100005] , ps2[100005];
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) {
int flag1 = 1 , flag2 = 1;
for (int i = 0; i < M; i++) {
if (X[i] >= 2) flag2 = 0;
if (X[i]%2 == 1) flag1 = 0;
if (X[i] == 0) a1[Y[i]+1] += W[i];
else a2[Y[i]+1] += W[i];
ans += W[i];
}
if (flag1 == 1) return ans;
ans = 0;
if (flag2 == 1) {
for (int i = 1; i <= N; i++) {
ps1[i] = ps1[i-1]+a1[i];
ps2[i] = ps2[i-1]+a2[i];
}
for (int i = 0; i <= N; i++) {
if (N >= 3) ans = max(ans , ps2[N]-ps2[i]+ps1[i]);
ans = max(ans , ps2[i]);
ans = max(ans , ps1[i]);
}
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... |