# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
657248 | lumibons | Catfish Farm (IOI22_fish) | C++17 | 481 ms | 60260 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;
#define sz(x) ((int) (x).size())
typedef long long ll;
ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) {
vector<vector<int>> p(n + 3);
for (int i = 0; i < m; i++)
for (int d = x[i] == 0 ? 0 : -1; d < (x[i] == n - 1 ? 1 : 2); d++)
p[x[i] + d + 1].push_back(y[i]);
vector<vector<ll>> ws(n + 3);
for (int i = 0; i < n + 3; i++) {
p[i].push_back(-1);
sort(p[i].begin(), p[i].end());
p[i].erase(unique(p[i].begin(), p[i].end()), p[i].end());
ws[i].resize(sz(p[i]));
}
for (int i = 0; i < m; i++) {
int j = (int) (lower_bound(p[x[i] + 1].begin(), p[x[i] + 1].end(), y[i]) - p[x[i] + 1].begin());
ws[x[i] + 1][j] += w[i];
}
for (int i = 0; i < n + 3; i++)
for (int j = 1; j < sz(ws[i]); j++)
ws[i][j] += ws[i][j - 1];
auto weightBelow = [&](int i, int j) {
int k = (int) (upper_bound(p[i].begin(), p[i].end(), j) - p[i].begin()) - 1;
# | 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... |