Submission #955529

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9555292024-03-30 20:02:05imannBank (IZhO14_bank)C++17
100 / 100
89 ms16988 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...