|
|
@ -25,11 +25,12 @@ struct Room{ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
std::map<std::string,Room>rooms; |
|
|
|
std::map<std::string,Room>rooms; |
|
|
|
|
|
|
|
std::vector<std::string>targetRooms; |
|
|
|
int maxFlow=0; |
|
|
|
int maxFlow=0; |
|
|
|
int iterations=0; |
|
|
|
int iterations=0; |
|
|
|
int branchesRemaining=0; |
|
|
|
int branchesRemaining=0; |
|
|
|
|
|
|
|
|
|
|
|
void printArr(std::vector<std::string> a, int n){ |
|
|
|
void printArr(int n){ |
|
|
|
int minutesRemaining1=26; |
|
|
|
int minutesRemaining1=26; |
|
|
|
int minutesRemaining2=26; |
|
|
|
int minutesRemaining2=26; |
|
|
|
std::string currentPos="AA"; |
|
|
|
std::string currentPos="AA"; |
|
|
@ -44,11 +45,11 @@ void printArr(std::vector<std::string> a, int n){ |
|
|
|
int flowTotal=0; |
|
|
|
int flowTotal=0; |
|
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<n;i++){ |
|
|
|
for (int i=0;i<n;i++){ |
|
|
|
std::string valve=a[i]; |
|
|
|
std::string valve=targetRooms[i]; |
|
|
|
if ((i&1)==0){ |
|
|
|
if (i&1){ |
|
|
|
movePlan1.push_back(valve); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
movePlan2.push_back(valve); |
|
|
|
movePlan2.push_back(valve); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
movePlan1.push_back(valve); |
|
|
|
} |
|
|
|
} |
|
|
|
//std::cout<<a[i]<<" ";
|
|
|
|
//std::cout<<a[i]<<" ";
|
|
|
|
} |
|
|
|
} |
|
|
@ -81,17 +82,17 @@ void printArr(std::vector<std::string> a, int n){ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void permutation(std::vector<std::string> a,int size, int n){ |
|
|
|
void permutation(int size, int n){ |
|
|
|
if (size==1){ |
|
|
|
if (size==1){ |
|
|
|
printArr(a,n); |
|
|
|
printArr(n); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
for (int i=0;i<size;i++){ |
|
|
|
for (int i=0;i<size;i++){ |
|
|
|
permutation(a,size-1,n); |
|
|
|
permutation(size-1,n); |
|
|
|
if (size&1){ |
|
|
|
if (size&1){ |
|
|
|
swap(a[0],a[size-1]); |
|
|
|
swap(targetRooms[i],targetRooms[size-i]); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
swap(a[i],a[size-i]); |
|
|
|
swap(targetRooms[0],targetRooms[size-1]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -157,7 +158,6 @@ void explore(std::string currentRoom,std::map<std::string,bool>visitedvalves,int |
|
|
|
|
|
|
|
|
|
|
|
int main() |
|
|
|
int main() |
|
|
|
{ |
|
|
|
{ |
|
|
|
std::vector<std::string>targetRooms; |
|
|
|
|
|
|
|
std::ifstream file("testinput"); |
|
|
|
std::ifstream file("testinput"); |
|
|
|
while (file.good()){ |
|
|
|
while (file.good()){ |
|
|
|
std::string line; |
|
|
|
std::string line; |
|
|
|