Submission #1210657

#TimeUsernameProblemLanguageResultExecution timeMemory
1210657qwushaCatfish Farm (IOI22_fish)C++20
0 / 100
34 ms6332 KiB
#include <bits/stdc++.h> #include "fish.h" using namespace std; #define fi first #define se second typedef long long ll; typedef long double ld; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); ll inf = 1e18; ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) { bool ok = 1; for (int i = 0; i < n; i++) { if (x[i] > 1) { ok = 0; } } if (ok) { vector<pair<int, int>> y0, y1; for (int i = 0; i < n; i++) { if (x[i] == 0) { y0.push_back({y[i], w[i]}); } else { y1.push_back({y[i], w[i]}); } } sort(y0.begin(), y0.end()); sort(y1.begin(), y1.end()); vector<ll> cnt0(n), cnt1(n); for (int i = 0; i < y0.size(); i++) { cnt0[y0[i].fi] += y0[i].se; } for (int i = 0; i < y1.size(); i++) { cnt1[y1[i].fi] += y1[i].se; } for (int i = 1; i < n; i++) { cnt0[i] += cnt0[i - 1]; cnt1[i] += cnt1[i - 1]; } ll res = max(cnt1[n - 1], cnt0[n - 1]); for (int i = 0; i < n; i++) { res = max(res, cnt0[i] + cnt1[n - 1] - cnt1[i]); } return res; } ll res = 0; for (int i = 0; i < m; i++) { res += w[i]; } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...