If there are multiple optimal solutions, you can print any of them.
Sample test(s) input2 3 3 2 A.A ... A.a ..C X.Y ...output
14 1 0 2 1 3 1input
1 1 4 1 A . B .output
3 1 0 2 0 4 2 3 0input
1 3 5 2 ABA BBB BBA BAB ABBoutput
11 1 0 3 1 2 3 4 2 5 1
#include#include #include #include #include using namespace std; struct Edge { int u,v,w; }edge[1100*1100]; bool cmp(Edge a,Edge b) { return a.w vc[1100]; int get_diff(char a[][20],char b[][20] ) { int ret=0; for(int i=0;i