# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
955529 | imann | Bank (IZhO14_bank) | C++17 | 89 ms | 16988 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 <iostream>
#include <array>
const int MAX_N = 21;
std::array<int, MAX_N> As, Bs;
std::array<std::pair<int, int>, (1 << MAX_N)> dp;
int solve(int n, int m) {
dp.fill({-1, 0});
for (int s = 1; s < (1 << m); ++s) {
for (int i = 0; i < m; ++i) {
if (s & (1 << i)) {
if (dp[s].first <= dp[s ^ (1 << i)].first) {
dp[s].first = dp[s ^ (1 << i)].first;
dp[s].second = dp[s ^ (1 << i)].second + Bs[i];
if (dp[s].second == As[dp[s].first + 1]) {
dp[s].first++;
dp[s].second = 0;
}
}
}
}
}
return dp[(1 << m) - 1].first;
}
int main() {
int n, m; std::cin >> n >> m;
# | 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... |