Submission #989694

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9896942024-05-28 15:03:49aaaaaarrozBank (IZhO14_bank)C++17
100 / 100
88 ms8792 KiB
#include <iostream>
#include <vector>
using std::cout;
using std::endl;
using std::vector;
int main() {
int people_num;
int note_num;
std::cin >> people_num >> note_num;
vector<int> people(people_num);
vector<int> banknotes(note_num);
for (int &p : people) { std::cin >> p; }
for (int &b : banknotes) { std::cin >> b; }
vector<int> leftover(1 << note_num, -1);
vector<int> people_covered(1 << note_num, -1);
leftover[0] = 0;
people_covered[0] = 0;
for (int s = 0; s < (1 << note_num); s++) {
for (int last = 0; last < note_num; last++) {
if ((s & (1 << last)) == 0) { continue; }
int prev = s & ~(1 << last);
if (people_covered[prev] == -1) { continue; }
int new_amt = leftover[prev] + banknotes[last];
// the salary of the current person we're going to try to pay
int curr_target = people[people_covered[prev]];
// if it's still not enough, just increment the leftover pile
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...