Created
July 5, 2022 17:29
-
-
Save andrewljohnson/c123aa96fd91559bbe66893eb9b21702 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void groupDefenders(vector<vector<int>> attackers, vector<int> defenders, int i) { | |
int x = 0; | |
for (vector<int> attackerBucket:attackers) { | |
cout << x << ": "; | |
for (int defender:attackerBucket) { | |
cout << defender << " "; | |
} | |
cout << "\n"; | |
x+= 1; | |
} | |
if(i == defenders.size()) { | |
return; | |
} | |
for(int v=0; v<attackers.size();++v) { | |
vector<int> attacker = attackers[v]; | |
attacker.push_back(defenders[i]); | |
attackers[v] = attacker; | |
groupDefenders(attackers, defenders, i+1); | |
attacker.pop_back(); | |
attackers[v] = attacker; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment