QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#692306 | #5520. Distance Parities | cmk666 | WA | 0ms | 3676kb | C++23 | 1.1kb | 2024-10-31 14:17:54 | 2024-10-31 14:18:00 |
Judging History
answer
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
constexpr int inf = numeric_limits < int >::max() >> 1;
int n, m, a[509][509], b[509][509]; char c;
inline void work()
{
cin >> n, m = 0;
For(i, 1, n) For(j, 1, n) cin >> c, a[i][j] = c - '0';
For(i, 1, n) For(j, 1, n) m += a[i][j], b[i][j] = a[i][j] ? 1 : i == j ? 0 : inf;
For(k, 1, n) For(i, 1, n) if ( i != k ) For(j, 1, n) if ( i != j && j != k )
b[i][j] = min(b[i][j], b[i][k] + b[k][j]);
For(i, 1, n) For(j, 1, n)
if ( b[i][j] == inf || a[i][j] != ( b[i][j] & 1 ) ) { cout << "Track Lost\n"; return; }
cout << "Pure Memory\n" << ( m >> 1 ) << '\n';
For(i, 1, n) For(j, i + 1, n) if ( a[i][j] ) cout << i << ' ' << j << '\n';
}
int main()
{
// freopen("bridge.in", "r", stdin), freopen("bridge.out", "w", stdout);
cin.tie(nullptr) -> sync_with_stdio(false);
int t; cin >> t; while ( t-- ) work(); return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3676kb
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)