QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#692673#5520. Distance Paritieszfs732WA 0ms3552kbC++141.3kb2024-10-31 14:53:522024-10-31 14:54:09

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 14:54:09]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-10-31 14:53:52]
  • 提交

answer

#include <bits/stdc++.h>

int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int test;
  std::cin >> test;
  while (test--) {
    int N;
    std::cin >> N;
    std::vector<std::vector<int>> G(N, std::vector<int>(N, 1E8));
    std::vector<std::vector<int>> S(N, std::vector<int>(N));
    std::vector<std::pair<int, int>> edges;
    for (int u = 0; u < N; u++) {
      G[u][u] = 0;
      for (int v = 0; v < N; v++) {
        char c;
        std::cin >> c, S[u][v] = c - '0';
        if (c == '1' && v > u) {
          edges.emplace_back(u, v);
          G[u][v] = G[v][u] = 1;
        }
      }
    }
    for (int k = 0; k < N; k++) {
      for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
          G[i][j] = std::min(G[i][j], G[i][k] + G[k][j]);
        }
      }
    }
    bool ok = true;
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        if (G[i][j] > N || (G[i][j] & 1) != S[i][j]) { ok = false; }
      }
    }
    if (ok) {
      std::cout << "Pure Memory\n";
      std::cout << edges.size() << '\n';
      for (auto t: edges) {
        std::cout << t.first + 1 << ' ' << t.second + 1 << '\n';
      }
    } else {
      std::cout << "Track Lost\n";
    }
  }

  return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3552kb

input:

3
3
011
101
110
4
0100
1000
0001
0010
5
01010
10101
01010
10101
01010

output:

Pure Memory
3
1 2
1 3
2 3
Track Lost
Pure Memory
6
1 2
1 4
2 3
2 5
3 4
4 5

result:

wrong answer Token parameter [name=yes/no] equals to "Pure", doesn't correspond to pattern "[yY][eE][sS]|[nN][oO]" (test case 1)