QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#692395#5520. Distance ParitiesXiaohubaWA 0ms3848kbC++203.2kb2024-10-31 14:26:502024-10-31 14:27:11

Judging History

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

  • [2024-10-31 14:27:11]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-10-31 14:26:50]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

// #define LOCK_GETCHAR
// #define USE_INT_128

#if __cplusplus < 201400
#warning "Please use c++14 or higher."
#define CONSTEXPR_FUNC
#define ENABLE_IF_INT
#else
#define CONSTEXPR_FUNC constexpr
#define ENABLE_IF_INT , enable_if_t<_is_integer<T>, int> = 0
template <class T> constexpr bool _is_integer = numeric_limits<T>::is_integer;
template <> constexpr bool _is_integer<bool> = false;
template <> constexpr bool _is_integer<char> = false;
#ifdef USE_INT_128
template <> constexpr bool _is_integer<__int128> = true;
template <> constexpr bool _is_integer<__uint128_t> = true;
#endif
#endif

#if !defined(_WIN32) && !defined(__CYGWIN__) && !defined(LOCK_GETCHAR)
#define getchar getchar_unlocked
#endif

#define il inline
#define mkp make_pair
#define fi first
#define se second
#define ssz(x) (signed((x).size()))
#define _loop_i_t(j, k) make_signed_t<decltype((j) - (k))>
#define For(i, j, k) for (_loop_i_t(j, k) i = (j); i <= (k); ++i) // NOLINT
#define ForDown(i, j, k)                                                       \
  for (_loop_i_t(j, k) i = (j); i >= decltype(i)(k); --i) // NOLINT
#define eb emplace_back
#ifndef ONLINE_JUDGE
#define FileIO(filename)                                                       \
  freopen(filename ".in", "r", stdin);                                         \
  freopen(filename ".out", "w", stdout)
#else
#define FileIO(filename) void(0)
#endif

using ll = long long;
using uint = unsigned int;
using ull = unsigned long long;
using db = double;
using ldb = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#ifdef USE_INT_128
using lll = __int128_t;
using ulll = __uint128_t;
#endif

// clang-format off
CONSTEXPR_FUNC il ll qpow(ll x, ull y, ll mod){ ll ans = 1; x %= mod; while (y) { if (y & 1) (ans *= x) %= mod; (x *= x) %= mod; y >>= 1; } return ans; }
template<typename T> CONSTEXPR_FUNC il void cmin(T & x, const T &y){ x = min(x, y); }
template<typename T> CONSTEXPR_FUNC il void cmax(T & x, const T &y){ x = max(x, y); }
template<typename T ENABLE_IF_INT> il void read(T &x){ x = 0; int f = 1; int c = getchar(); while (!isdigit(c)) { if (c == '-') f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + (c - '0'); c = getchar(); } x *= f; }
template<typename T, typename ... Args> il void read(T &x, Args &... y){ read(x), read(y...); }
// clang-format on

// File head end

namespace {
constexpr ll MAXN = 505;
int T, n, a[MAXN][MAXN], f[MAXN][MAXN];
bool check() {
  For(i, 1, n) For(j, 1, n) {
    if ((f[i][j] >= 1e9 + 5) || (f[i][j] & 1) != a[i][j])
      return 0;
  }
  return 1;
}
il void Main() {
  FileIO("bridge");
  read(T);
  while (T--) {
    read(n);
    int cnt = 0;
    For(i, 1, n) For(j, 1, n) {
      scanf("%1d", &a[i][j]);
      f[i][j] = a[i][j] ? 1 : 1e9 + 5;
      if (i < j && a[i][j])
        cnt++;
    }
    For(i, 1, n) f[i][i] = 0;
    For(k, 1, n) For(i, 1, n) For(j, 1, n) { cmin(f[i][j], f[i][k] + f[k][j]); }
    if (check()) {
      puts("Pure Memory");
      cout << cnt << '\n';
      For(i, 1, n) For(j, i + 1, n) if (a[i][j]) cout << i << ' ' << j << '\n';
    } else
      puts("Track Lost");
  }
}
} // namespace

signed main() { return Main(), 0; }

详细

Test #1:

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

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)