35 for (
const std::string&
line :
37 const std::vector<std::string> tokens =
38 absl::StrSplit(
line,
' ', absl::SkipEmpty());
39 if (tokens.empty())
continue;
41 CHECK_GE(tokens.size(), 1);
42 CHECK_LE(tokens.size(), 2);
43 CHECK(absl::SimpleAtoi(tokens[0], &n));
46 for (
int j = 0; j < n; ++j) {
47 qap_problem.
weights[j].assign(n, std::numeric_limits<int64_t>::max());
48 qap_problem.
distances[j].assign(n, std::numeric_limits<int64_t>::max());
50 if (tokens.size() == 2) {
54 }
else if (k <= n * n) {
55 for (
const std::string& token : tokens) {
56 const int i = (k - 1) / n;
57 const int j = (k - 1) % n;
59 CHECK(absl::SimpleAtoi(token, &v)) <<
"'" << token <<
"'";
63 }
else if (k <= 2 * n * n) {
64 for (
const std::string& token : tokens) {
65 const int i = (k - n * n - 1) / n;
66 const int j = (k - n * n - 1) % n;
68 CHECK(absl::SimpleAtoi(token, &v));
73 CHECK(
false) <<
"File contains more than 1 + 2 * N^2 entries.";