{"trustable":false,"sections":[{"title":"","value":{"format":"MD","content":"#### 需要征募女兵N人,男兵M人。 每招募一个人需要花费10000美元。 如果已经招募的人中有一些关系亲密的人,那么可以少花一些钱。 给出若干男女之前的1 ~ 9999 之间的亲密度关系, 招募某个人的费用是 10000 - (已经招募了的人中和自己的亲密度的最大值)。 要求通过适当的招募顺序使得招募所有人所花费的费用最小。"}},{"title":"Input","value":{"format":"MD","content":"输入N, M, R;\n接下来输入R行 (x, y, d) 表示第 x 号男兵和第 y 号女兵之间的亲密度是 d"}},{"title":"Output","value":{"format":"MD","content":"输入最小花费的值。"}},{"title":"Sample Input","value":{"format":"MD","content":"2\n\n5 5 8\n4 3 6831\n1 3 4583\n0 0 6592\n0 1 3063\n3 3 4975\n1 3 2049\n4 2 2104\n2 2 781\n\n5 5 10\n2 4 9820\n3 2 6236\n3 1 8864\n2 4 8326\n2 0 5156\n2 0 1463\n4 1 2439\n0 4 4373\n3 4 8889\n2 4 3133\n"}},{"title":"Sample Output","value":{"format":"MD","content":"71071\n54223\n"}}]}